Spaces:
Runtime error
Runtime error
Commit
·
5f278b8
1
Parent(s):
52ec872
Update app.py
Browse files
app.py
CHANGED
@@ -30,7 +30,7 @@ def openai_chat(api_key, model, message):
|
|
30 |
# Define the chat function for Hugging Face API
|
31 |
def hf_chat(model_name, message):
|
32 |
# Load the model and tokenizer
|
33 |
-
model = transformers.pipeline("
|
34 |
|
35 |
# Generate a response from the model
|
36 |
bot_response = model(message, max_length=1024, do_sample=True, temperature=0.7)[0]["generated_text"]
|
@@ -41,8 +41,8 @@ def hf_chat(model_name, message):
|
|
41 |
api_key_input = gr.inputs.Textbox(label="OpenAI API Key", default=None)
|
42 |
model_input = gr.inputs.Dropdown(
|
43 |
label="Select OpenAI model",
|
44 |
-
choices=["
|
45 |
-
default="
|
46 |
)
|
47 |
message_input = gr.inputs.Textbox(label="Enter your message here")
|
48 |
output = gr.outputs.Textbox(label="Bot response")
|
|
|
30 |
# Define the chat function for Hugging Face API
|
31 |
def hf_chat(model_name, message):
|
32 |
# Load the model and tokenizer
|
33 |
+
model = transformers.pipeline("text-generation", model=model_name)
|
34 |
|
35 |
# Generate a response from the model
|
36 |
bot_response = model(message, max_length=1024, do_sample=True, temperature=0.7)[0]["generated_text"]
|
|
|
41 |
api_key_input = gr.inputs.Textbox(label="OpenAI API Key", default=None)
|
42 |
model_input = gr.inputs.Dropdown(
|
43 |
label="Select OpenAI model",
|
44 |
+
choices=["davinci", "curie", "babbage"],
|
45 |
+
default="davinci",
|
46 |
)
|
47 |
message_input = gr.inputs.Textbox(label="Enter your message here")
|
48 |
output = gr.outputs.Textbox(label="Bot response")
|