Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,7 +4,7 @@ from huggingface_hub import InferenceClient
|
|
4 |
# Initialize the InferenceClient
|
5 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
6 |
|
7 |
-
# Define the function for
|
8 |
def generate_output():
|
9 |
# Initialize the prompt
|
10 |
prompt = "Initialize your prompt here."
|
@@ -12,11 +12,17 @@ def generate_output():
|
|
12 |
response = client.text_generation(prompt, max_new_tokens=512, temperature=0.7, top_p=0.95)
|
13 |
return response[0]['generated_text']
|
14 |
|
15 |
-
#
|
16 |
-
|
|
|
|
|
17 |
|
18 |
-
#
|
19 |
-
|
|
|
|
|
|
|
|
|
20 |
|
21 |
# Launch the app
|
22 |
if __name__ == "__main__":
|
|
|
4 |
# Initialize the InferenceClient
|
5 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
6 |
|
7 |
+
# Define the function for generating output based on a prompt
|
8 |
def generate_output():
|
9 |
# Initialize the prompt
|
10 |
prompt = "Initialize your prompt here."
|
|
|
12 |
response = client.text_generation(prompt, max_new_tokens=512, temperature=0.7, top_p=0.95)
|
13 |
return response[0]['generated_text']
|
14 |
|
15 |
+
# Define the action to be taken when the button is clicked
|
16 |
+
def button_click():
|
17 |
+
# Generate output based on the prompt when the button is clicked
|
18 |
+
output_textbox.update(generate_output())
|
19 |
|
20 |
+
# Create a Gradio interface with a button and a text output
|
21 |
+
button = gr.Button("Generate Output", onclick=button_click)
|
22 |
+
output_textbox = gr.outputs.Textbox(label="Output")
|
23 |
+
|
24 |
+
# Combine the button and the text output in a Gradio interface
|
25 |
+
interface = gr.Interface(button, output_textbox)
|
26 |
|
27 |
# Launch the app
|
28 |
if __name__ == "__main__":
|