Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -33,17 +33,18 @@ def generate_response(user_input, max_new_tokens, temperature):
|
|
33 |
gen_text = tokenizer.decode(gen_tokens[0])
|
34 |
return gen_text
|
35 |
|
36 |
-
example_choices = {f"Example {i+1}": example for i, example in enumerate(examples)}
|
37 |
|
38 |
-
def load_example(choice):
|
39 |
-
example = example_choices[choice]
|
40 |
-
return example
|
41 |
|
42 |
examples = [
|
43 |
{"message": "What is the weather like today?", "max_new_tokens": 250, "temperature": 0.5},
|
44 |
{"message": "Tell me a joke.", "max_new_tokens": 650, "temperature": 0.7},
|
45 |
{"message": "Explain the concept of machine learning.", "max_new_tokens": 980, "temperature": 0.4}
|
46 |
]
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
with gr.Blocks() as demo:
|
49 |
gr.Markdown(title)
|
|
|
33 |
gen_text = tokenizer.decode(gen_tokens[0])
|
34 |
return gen_text
|
35 |
|
|
|
36 |
|
|
|
|
|
|
|
37 |
|
38 |
examples = [
|
39 |
{"message": "What is the weather like today?", "max_new_tokens": 250, "temperature": 0.5},
|
40 |
{"message": "Tell me a joke.", "max_new_tokens": 650, "temperature": 0.7},
|
41 |
{"message": "Explain the concept of machine learning.", "max_new_tokens": 980, "temperature": 0.4}
|
42 |
]
|
43 |
+
example_choices = {f"Example {i+1}": example for i, example in enumerate(examples)}
|
44 |
+
|
45 |
+
def load_example(choice_index):
|
46 |
+
example = examples[choice_index]
|
47 |
+
return example["message"], example["max_new_tokens"], example["temperature"]
|
48 |
|
49 |
with gr.Blocks() as demo:
|
50 |
gr.Markdown(title)
|