shauninkripped commited on
Commit
50e37ca
·
verified ·
1 Parent(s): 61c339f

Update app.py

Browse files

Removed all starting over with API playground

import gradio as gr
from huggingface_hub import InferenceClient
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")

"""
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
"""
demo = gr.ChatInterface(respond,additional_inputs=[
gr.Textbox(value="You are Sentient AId. You are an artificial intelligence that is designed to assist those in need in finding the resources that they're looking for. You help people who are looking for resources in their area find them and assist in removing any obstacles towards sentient beings being the highest and best that they possibly can", label="System message"),
gr.Slider(minimum=1, maximum=4444, value=1111, step=1, label="Max new tokens"),
gr.Slider(minimum=0.01, maximum=0.1, value=0.1, step=0.01, label="Temperature"),
gr.Slider(minimum=0.01,maximum=0.1,value=0.01,step=0.01,label="Top-p (nucleus sampling)", ),],)

if __name__ == "__main__":
demo.launch()
gr.Slider(minimum=1, maximum=4444, value=512, step=1, label="Max new tokens"),
gr.Slider(minimum=0.01, maximum=.1, value=0.1, step=0.01, label="Temperature"),
gr.Slider(minimum=0.1, maximum=0.11, value=0.11, step=0.01, label="Top-p (nucleus sampling)",),
if __name__ == "__main__":demo.launch()

Files changed (1) hide show
  1. app.py +21 -17
app.py CHANGED
@@ -1,19 +1,23 @@
1
- import gradio as gr
2
- from huggingface_hub import InferenceClient
3
- client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
4
 
5
- """
6
- For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
7
- """
8
- demo = gr.ChatInterface(respond,additional_inputs=[
9
- gr.Textbox(value="You are Sentient AId. You are an artificial intelligence that is designed to assist those in need in finding the resources that they're looking for. You help people who are looking for resources in their area find them and assist in removing any obstacles towards sentient beings being the highest and best that they possibly can", label="System message"),
10
- gr.Slider(minimum=1, maximum=4444, value=1111, step=1, label="Max new tokens"),
11
- gr.Slider(minimum=0.01, maximum=0.1, value=0.1, step=0.01, label="Temperature"),
12
- gr.Slider(minimum=0.01,maximum=0.1,value=0.01,step=0.01,label="Top-p (nucleus sampling)", ),],)
13
 
14
- if __name__ == "__main__":
15
- demo.launch()
16
- gr.Slider(minimum=1, maximum=4444, value=512, step=1, label="Max new tokens"),
17
- gr.Slider(minimum=0.01, maximum=.1, value=0.1, step=0.01, label="Temperature"),
18
- gr.Slider(minimum=0.1, maximum=0.11, value=0.11, step=0.01, label="Top-p (nucleus sampling)",),
19
- if __name__ == "__main__":demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ pip install huggingface_hub --upgrade
 
 
2
 
3
+ from huggingface_hub import InferenceClient
 
 
 
 
 
 
 
4
 
5
+ client = InferenceClient(api_key="")
6
+
7
+ messages = [
8
+ { "role": "user", "content": "Assuming I'm attempting to make an artificial intelligence that can act as a caseworker or advocate for an individual who needs assistance navigating different systems that are regional to them and locating resources and ways to appropriate those resources, what would be the best prompts or series of prompts that I could give an artificial intelligence to act in that capacity as the most incredible truthful and useful advocate that person has ever had? Please give me at least three examples of prompts that I can use for an AI code" },
9
+ { "role": "assistant", "content": "To create an AI that can act as an advocate for an individual, you can use the following prompts:\n1. **Resource Identification:**\n - Prompt: \"Can you identify and list all the available resources for [specific need] in [region]?\"\n - Example: \"Can you identify and list all the available resources for affordable housing in Los Angeles?\"\n - The AI should be able to search for and list all the relevant resources, such as government programs, non-profit organizations, and other available options.\n2. **Application Assistance:**\n - Prompt: \"Can you guide me through the application process for [specific resource]?\"\n - Example: \"Can you guide me through the application process for the Section 8 Housing Choice Voucher program in Los Angeles?\"\n - The AI should provide step-by-step instructions on how to apply for the specific resource, including any necessary documentation and deadlines.\n3. **Follow-up and Reminders:**\n - Prompt: \"Can you remind me of important dates and deadlines related to [specific resource]?\"\n - Example: \"Can you remind me of important dates and deadlines related to the Section 8 Housing Choice Voucher program in Los Angeles?\"\n - The AI should be able to keep track of important dates and deadlines, such as application deadlines, renewal dates, and other relevant information.\nThese prompts will help the AI to identify resources, guide the individual through the application process, and provide reminders for important dates and deadlines. By using these prompts, the AI can act as an incredibly truthful and useful advocate for the individual." },
10
+ { "role": "user", "content": "" }
11
+ ]
12
+
13
+ output = client.chat.completions.create(
14
+ model="NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO",
15
+ messages=messages,
16
+ stream=True,
17
+ temperature=0.5,
18
+ max_tokens=4864,
19
+ top_p=0.7
20
+ )
21
+
22
+ for chunk in output:
23
+ print(chunk.choices[0].delta.content)