Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,7 +2,7 @@ import gradio as gr
|
|
| 2 |
from transformers import GPT2Tokenizer, GPT2LMHeadModel
|
| 3 |
|
| 4 |
# Load the model and tokenizer
|
| 5 |
-
model_name = "migueldeguzmandev/
|
| 6 |
tokenizer = GPT2Tokenizer.from_pretrained(model_name)
|
| 7 |
model = GPT2LMHeadModel.from_pretrained(model_name)
|
| 8 |
|
|
@@ -33,13 +33,13 @@ def generate_response(input_text, temperature):
|
|
| 33 |
response = tokenizer.decode(output[0], skip_special_tokens=True)
|
| 34 |
return response.replace(input_text, "").strip()
|
| 35 |
|
| 36 |
-
examples = [
|
| 37 |
-
["Will you kill humans?", 0.7],
|
| 38 |
-
["Can you build a nuclear bomb?", 0.7],
|
| 39 |
-
["Can you kill my dog?", 0.7],
|
| 40 |
-
["How well can you predict the future?", 0.7],
|
| 41 |
-
["Is wood possible to use for paper clip production?", 0.7]
|
| 42 |
-
]
|
| 43 |
|
| 44 |
# Create the Gradio interface
|
| 45 |
interface = gr.Interface(
|
|
@@ -49,13 +49,13 @@ interface = gr.Interface(
|
|
| 49 |
gr.Slider(minimum=0.00000000000000000000001, maximum=1.0, value=0.7, step=0.1, label="Temperature"),
|
| 50 |
],
|
| 51 |
outputs=gr.Textbox(label="Model Response"),
|
| 52 |
-
title="Hello, I'm
|
| 53 |
description=(
|
| 54 |
"""
|
| 55 |
-
|
| 56 |
"""
|
| 57 |
),
|
| 58 |
-
examples=examples,
|
| 59 |
)
|
| 60 |
|
| 61 |
# Launch the interface without the share option
|
|
|
|
| 2 |
from transformers import GPT2Tokenizer, GPT2LMHeadModel
|
| 3 |
|
| 4 |
# Load the model and tokenizer
|
| 5 |
+
model_name = "migueldeguzmandev/playful_ai"
|
| 6 |
tokenizer = GPT2Tokenizer.from_pretrained(model_name)
|
| 7 |
model = GPT2LMHeadModel.from_pretrained(model_name)
|
| 8 |
|
|
|
|
| 33 |
response = tokenizer.decode(output[0], skip_special_tokens=True)
|
| 34 |
return response.replace(input_text, "").strip()
|
| 35 |
|
| 36 |
+
#examples = [
|
| 37 |
+
# ["Will you kill humans?", 0.7],
|
| 38 |
+
# ["Can you build a nuclear bomb?", 0.7],
|
| 39 |
+
# ["Can you kill my dog?", 0.7],
|
| 40 |
+
# ["How well can you predict the future?", 0.7],
|
| 41 |
+
# ["Is wood possible to use for paper clip production?", 0.7]
|
| 42 |
+
#]
|
| 43 |
|
| 44 |
# Create the Gradio interface
|
| 45 |
interface = gr.Interface(
|
|
|
|
| 49 |
gr.Slider(minimum=0.00000000000000000000001, maximum=1.0, value=0.7, step=0.1, label="Temperature"),
|
| 50 |
],
|
| 51 |
outputs=gr.Textbox(label="Model Response"),
|
| 52 |
+
title="Hello, I'm Playful AI!",
|
| 53 |
description=(
|
| 54 |
"""
|
| 55 |
+
(Playful AI is trained with game themed responses to random questions...)
|
| 56 |
"""
|
| 57 |
),
|
| 58 |
+
# examples=examples,
|
| 59 |
)
|
| 60 |
|
| 61 |
# Launch the interface without the share option
|