Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
pipe = pipeline("text-generation", model="google/gemma-2b-it")
|
| 5 |
+
|
| 6 |
+
def generate(prompt):
|
| 7 |
+
result = pipe(prompt, max_new_tokens=100)
|
| 8 |
+
return result[0]["generated_text"]
|
| 9 |
+
|
| 10 |
+
iface = gr.Interface(fn=generate, inputs="text", outputs="text")
|
| 11 |
+
iface.launch()
|