Spaces:
Sleeping
Sleeping
| from os import name | |
| import gradio as gr | |
| from transformers import pipeline | |
| # Load profiles once at module level | |
| with open('Profiles/Python Translator.txt', 'r') as f: | |
| python_profile = f.read() | |
| def greet(input_text): | |
| pipe = pipeline("text-generation", model="moonshotai/Kimi-K2-Thinking", trust_remote_code=True) | |
| messages = [ | |
| {"role": python_profile, "content": input_text}, | |
| ] | |
| pipe(messages) | |
| return pipe[0]['generated_text'] | |
| demo = gr.Interface(fn=greet, inputs="text", outputs="text") | |
| demo.launch() |