Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -26,9 +26,6 @@ def generate_response(prompt, max_new_tokens=200, temperature=0.7):
|
|
26 |
"""
|
27 |
Generate a response from the fine-tuned Phi-2 model given a prompt.
|
28 |
"""
|
29 |
-
if not prompt.strip():
|
30 |
-
return "Please enter a prompt to generate a response."
|
31 |
-
|
32 |
# Tokenize the prompt and move tensors to the model's device.
|
33 |
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
34 |
|
@@ -59,9 +56,7 @@ demo = gr.Interface(
|
|
59 |
["Hello, how are you today?", 150, 0.7],
|
60 |
["Translate this sentence from English to French: I love programming.", 200, 0.8],
|
61 |
["Tell me a joke about artificial intelligence.", 180, 0.6]
|
62 |
-
]
|
63 |
-
allow_flagging="never", # Disable the flagging button.
|
64 |
-
live=True # Ensure examples trigger responses.
|
65 |
)
|
66 |
|
67 |
if __name__ == "__main__":
|
|
|
26 |
"""
|
27 |
Generate a response from the fine-tuned Phi-2 model given a prompt.
|
28 |
"""
|
|
|
|
|
|
|
29 |
# Tokenize the prompt and move tensors to the model's device.
|
30 |
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
31 |
|
|
|
56 |
["Hello, how are you today?", 150, 0.7],
|
57 |
["Translate this sentence from English to French: I love programming.", 200, 0.8],
|
58 |
["Tell me a joke about artificial intelligence.", 180, 0.6]
|
59 |
+
]
|
|
|
|
|
60 |
)
|
61 |
|
62 |
if __name__ == "__main__":
|