PaulFancher commited on
Commit
cc7dba3
·
verified ·
1 Parent(s): 4df5b64

Update app.py

Browse files

Attempting to fast track Python translation

Files changed (1) hide show
  1. app.py +7 -3
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/Meaning-Expounder.txt', 'r') as f:
7
  python_profile = f.read()
8
 
9
  def greet(input_text):
10
- pipe = pipeline("text-generation", model="HuggingFaceTB/SmolLM-135M")
11
- return pipe.__call__(python_profile + " " + input_text, max_length=512, do_sample=True, temperature=0.7)[0]['generated_text']
 
 
 
 
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")