Spaces:
Runtime error
Runtime error
Commit
·
246cae1
1
Parent(s):
0119da7
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import transformers
|
3 |
+
from transformers import pipeline
|
4 |
+
|
5 |
+
st.title("Text Generation with Hugging Face")
|
6 |
+
|
7 |
+
model_name = "bigscience/mt0-xxl-mt"
|
8 |
+
generator = pipeline("text-generation", model=model_name, device=0)
|
9 |
+
|
10 |
+
prompt = st.text_input("Enter text prompt:", "Once upon a time")
|
11 |
+
|
12 |
+
if st.button("Generate Text"):
|
13 |
+
output = generator(prompt, max_length=100, do_sample=True)
|
14 |
+
st.write(output[0]['generated_text'])
|