abhillubillu commited on
Commit
3467c38
·
verified ·
1 Parent(s): 6a703df

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -9
app.py CHANGED
@@ -4,7 +4,13 @@ from huggingface_hub import InferenceClient
4
  """
5
  For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
6
  """
 
 
7
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
 
 
 
 
8
 
9
  def respond(
10
  message,
@@ -22,13 +28,7 @@ def respond(
22
  if val[1]:
23
  messages.append({"role": "assistant", "content": val[1]})
24
 
25
- # Modify the prompt based on whether JSON output is requested
26
- if "json" in message.lower():
27
- modified_message = f"You are the best generator of gamification content. Your content is always engaging and awesome. Generate the following in JSON format: {message}"
28
- else:
29
- modified_message = f"You are a friendly and helpful assistant. {message}"
30
-
31
- messages.append({"role": "user", "content": modified_message})
32
 
33
  response = ""
34
 
@@ -50,7 +50,7 @@ For information on how to customize the ChatInterface, peruse the gradio docs: h
50
  demo = gr.ChatInterface(
51
  respond,
52
  additional_inputs=[
53
- gr.Textbox(value="You are the best generator of gamification content. Your content is always engaging and awesome. You generate JSON data when asked.", label="System message"),
54
  gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
55
  gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
56
  gr.Slider(
@@ -63,5 +63,6 @@ demo = gr.ChatInterface(
63
  ],
64
  )
65
 
 
66
  if __name__ == "__main__":
67
- demo.launch()
 
4
  """
5
  For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
6
  """
7
+
8
+ # client = InferenceClient("meta-llama/Meta-Llama-3-8B-Instruct")
9
  client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
10
+ # client = InferenceClient("meta-llama/Meta-Llama-3-8B-Instruct" , "HPAI-BSC/Llama3-Aloe-8B-Alpha")
11
+ # client = InferenceClient("Xenova/gpt-4o")
12
+ # client = InferenceClient("mistralai/mamba-codestral-7B-v0.1")
13
+ # client = InferenceClient("deepseek-ai/DeepSeek-Coder-V2-Instruct")
14
 
15
  def respond(
16
  message,
 
28
  if val[1]:
29
  messages.append({"role": "assistant", "content": val[1]})
30
 
31
+ messages.append({"role": "user", "content": message})
 
 
 
 
 
 
32
 
33
  response = ""
34
 
 
50
  demo = gr.ChatInterface(
51
  respond,
52
  additional_inputs=[
53
+ gr.Textbox(value="You are a friendly Chatbot. your name is QuizBotAI , you are a code expert . output everything in .json format . ", label="System message"),
54
  gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
55
  gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
56
  gr.Slider(
 
63
  ],
64
  )
65
 
66
+
67
  if __name__ == "__main__":
68
+ demo.launch()