Khoa commited on
Commit
72072cd
Β·
verified Β·
1 Parent(s): 26f8ef4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -3
app.py CHANGED
@@ -1,7 +1,18 @@
1
  import gradio as gr
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
  iface.launch()
 
1
  import gradio as gr
2
 
3
+ def generate_primes(text_input):
4
+ inputs = tokenizer(text_input, return_tensors="pt", return_attention_mask=False)
5
+ outputs = model.generate(**inputs, max_length=200)
6
+ generated_text = tokenizer.batch_decode(outputs)[0]
7
+ return generated_text
8
+
9
+ iface = gr.Interface(
10
+ fn=generate_primes,
11
+ inputs=gr.Textbox(),
12
+ outputs=gr.Textbox(),
13
+ live=True,
14
+ title="Prime Generator",
15
+ description="Generate primes based on input text."
16
+ )
17
 
 
18
  iface.launch()