Arjun Singh commited on
Commit
17ef741
·
1 Parent(s): b3dff59

Added Zephyr

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -1,8 +1,14 @@
1
  import gradio as gr
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
 
 
 
5
 
6
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
7
  demo.launch()
8
- #test comment
 
 
1
  import gradio as gr
2
+ from huggingface_hub import InferenceClient
3
 
4
+ def chat_with_Zephyr(prompt, hugging_face_api_key):
5
+ model_name = "HuggingFaceH4/zephyr-7b-beta"
6
+ client = InferenceClient(model=model_name,token=hugging_face_api_key)
7
+ messages = [{"role": "user", "content": prompt}]
8
+ response = client.chat_completion(messages,max_tokens=50,temperature=0.7)
9
+ return response.choices[0].message.content
10
 
11
+ demo = gr.Interface(fn=chat_with_Zephyr, inputs=[gr.Textbox(label="Prompt"),gr.Textbox(label="Hugging Face API Key", type="password")],outputs="text")
12
  demo.launch()
13
+ #test comment
14
+