Spaces:
Runtime error
Runtime error
Update app.py
#1
by
Khoa
- opened
app.py
CHANGED
|
@@ -1,7 +1,18 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
-
def
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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()
|