SrijitMukherjee commited on
Commit
b26224b
·
verified ·
1 Parent(s): 03dba33

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from huggingface_hub import InferenceClient
3
+
4
+ # Initialize the InferenceClient
5
+ client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
6
+
7
+ # Define the function for the button click
8
+ def generate_output():
9
+ # Initialize the prompt
10
+ prompt = "Initialize your prompt here."
11
+ # Generate output based on the prompt
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
+ # Create a Gradio interface with a button
16
+ button = gr.Button("Generate Output", onclick=generate_output)
17
+
18
+ # Combine the button with a text output
19
+ interface = gr.Interface(button, gr.outputs.Textbox(label="Output"))
20
+
21
+ # Launch the app
22
+ if __name__ == "__main__":
23
+ interface.launch()