Spaces:
Runtime error
Runtime error
upload huggingface spaces
Browse files- app.py +21 -0
- requirements.txt +2 -0
app.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from aitextgen import aitextgen
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def text_gen(text):
|
| 6 |
+
|
| 7 |
+
model_name = "EleutherAI/gpt-neo-125M"
|
| 8 |
+
model = aitextgen(model = model_name, to_gpu = True)
|
| 9 |
+
text_generated = model.generate_one(max_length=1000, prompt = text, no_repeat_ngram_size = 3)
|
| 10 |
+
|
| 11 |
+
return text_generated
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
output_text = gr.outputs.Textbox()
|
| 15 |
+
|
| 16 |
+
gr.Interface(text_gen,
|
| 17 |
+
inputs = gr.inputs.Textbox(label = "Input Text"),
|
| 18 |
+
outputs = gr.outputs.Textbox(),
|
| 19 |
+
title = "Blog Generator using AI",
|
| 20 |
+
description = "Create a 1000 word blog on any topic").launch()
|
| 21 |
+
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
aitextgen
|
| 2 |
+
gradio
|