Spaces:
Sleeping
Sleeping
Update app.py
Browse filesAttempting to fast track Python translation
app.py
CHANGED
|
@@ -3,12 +3,16 @@ import gradio as gr
|
|
| 3 |
from transformers import pipeline
|
| 4 |
|
| 5 |
# Load profiles once at module level
|
| 6 |
-
with open('Profiles/
|
| 7 |
python_profile = f.read()
|
| 8 |
|
| 9 |
def greet(input_text):
|
| 10 |
-
pipe = pipeline("text-generation", model="
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
|
| 14 |
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
|
|
|
| 3 |
from transformers import pipeline
|
| 4 |
|
| 5 |
# Load profiles once at module level
|
| 6 |
+
with open('Profiles/Python Translator.txt', 'r') as f:
|
| 7 |
python_profile = f.read()
|
| 8 |
|
| 9 |
def greet(input_text):
|
| 10 |
+
pipe = pipeline("text-generation", model="moonshotai/Kimi-K2-Thinking", trust_remote_code=True)
|
| 11 |
+
messages = [
|
| 12 |
+
{"role": python_profile, "content": input_text},
|
| 13 |
+
]
|
| 14 |
+
pipe(messages)
|
| 15 |
+
return pipe[0]['generated_text']
|
| 16 |
|
| 17 |
|
| 18 |
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|