Spaces:
Sleeping
Sleeping
JakeTurner616
commited on
Create cosmere_llm_gradio.py
Browse files- cosmere_llm_gradio.py +12 -0
cosmere_llm_gradio.py
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
model_name = "JakeTurner616/Adonalsium-gpt2" # Replace with your model's name on Hugging Face
|
5 |
+
generator = pipeline('text-generation', model=model_name)
|
6 |
+
|
7 |
+
def generate_text(prompt):
|
8 |
+
results = generator(prompt, max_length=100, num_return_sequences=1)
|
9 |
+
return results[0]['generated_text']
|
10 |
+
|
11 |
+
iface = gr.Interface(fn=generate_text, inputs="text", outputs="text")
|
12 |
+
iface.launch()
|