Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,7 +7,7 @@ hf_token = os.getenv("hf_token")
|
|
| 7 |
generator = pipeline("text-generation", model="isitcoding/gpt2_120_finetuned", use_auth_token=hf_token)
|
| 8 |
|
| 9 |
# Define the response function with additional options for customization
|
| 10 |
-
def text_generation(
|
| 11 |
prompt: str,
|
| 12 |
details: bool = False,
|
| 13 |
stream: bool = False,
|
|
@@ -68,3 +68,13 @@ iface = gr.Interface(
|
|
| 68 |
|
| 69 |
# Launch the interface
|
| 70 |
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
generator = pipeline("text-generation", model="isitcoding/gpt2_120_finetuned", use_auth_token=hf_token)
|
| 8 |
|
| 9 |
# Define the response function with additional options for customization
|
| 10 |
+
'''def text_generation(
|
| 11 |
prompt: str,
|
| 12 |
details: bool = False,
|
| 13 |
stream: bool = False,
|
|
|
|
| 68 |
|
| 69 |
# Launch the interface
|
| 70 |
iface.launch()
|
| 71 |
+
'''
|
| 72 |
+
|
| 73 |
+
# Test model generation
|
| 74 |
+
def generate_response(prompt):
|
| 75 |
+
response = generator(prompt, max_length=50)
|
| 76 |
+
return response[0]["generated_text"]
|
| 77 |
+
|
| 78 |
+
# Gradio interface
|
| 79 |
+
import gradio as gr
|
| 80 |
+
gr.Interface(fn=generate_response, inputs="text", outputs="text").launch()
|