Spaces:
Build error
Build error
Commit ·
e41537b
1
Parent(s): 3cb81a7
first batch
Browse files- .idea/.gitignore +8 -0
- .idea/inspectionProfiles/profiles_settings.xml +6 -0
- .idea/misc.xml +7 -0
- .idea/modules.xml +8 -0
- .idea/vcs.xml +6 -0
- .idea/zero.iml +10 -0
- app.py +17 -13
.idea/.gitignore
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Default ignored files
|
| 2 |
+
/shelf/
|
| 3 |
+
/workspace.xml
|
| 4 |
+
# Editor-based HTTP Client requests
|
| 5 |
+
/httpRequests/
|
| 6 |
+
# Datasource local storage ignored files
|
| 7 |
+
/dataSources/
|
| 8 |
+
/dataSources.local.xml
|
.idea/inspectionProfiles/profiles_settings.xml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<component name="InspectionProjectProfileManager">
|
| 2 |
+
<settings>
|
| 3 |
+
<option name="USE_PROJECT_PROFILE" value="false" />
|
| 4 |
+
<version value="1.0" />
|
| 5 |
+
</settings>
|
| 6 |
+
</component>
|
.idea/misc.xml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<project version="4">
|
| 3 |
+
<component name="Black">
|
| 4 |
+
<option name="sdkName" value="Python 3.10 (zero)" />
|
| 5 |
+
</component>
|
| 6 |
+
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (zero)" project-jdk-type="Python SDK" />
|
| 7 |
+
</project>
|
.idea/modules.xml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<project version="4">
|
| 3 |
+
<component name="ProjectModuleManager">
|
| 4 |
+
<modules>
|
| 5 |
+
<module fileurl="file://$PROJECT_DIR$/.idea/zero.iml" filepath="$PROJECT_DIR$/.idea/zero.iml" />
|
| 6 |
+
</modules>
|
| 7 |
+
</component>
|
| 8 |
+
</project>
|
.idea/vcs.xml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<project version="4">
|
| 3 |
+
<component name="VcsDirectoryMappings">
|
| 4 |
+
<mapping directory="" vcs="Git" />
|
| 5 |
+
</component>
|
| 6 |
+
</project>
|
.idea/zero.iml
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<module type="PYTHON_MODULE" version="4">
|
| 3 |
+
<component name="NewModuleRootManager">
|
| 4 |
+
<content url="file://$MODULE_DIR$">
|
| 5 |
+
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
| 6 |
+
</content>
|
| 7 |
+
<orderEntry type="inheritedJdk" />
|
| 8 |
+
<orderEntry type="sourceFolder" forTests="false" />
|
| 9 |
+
</component>
|
| 10 |
+
</module>
|
app.py
CHANGED
|
@@ -6,14 +6,16 @@ For more information on `huggingface_hub` Inference API support, please check th
|
|
| 6 |
"""
|
| 7 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
| 8 |
|
|
|
|
|
|
|
| 9 |
|
| 10 |
def respond(
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
):
|
| 18 |
messages = [{"role": "system", "content": system_message}]
|
| 19 |
|
|
@@ -28,21 +30,24 @@ def respond(
|
|
| 28 |
response = ""
|
| 29 |
|
| 30 |
for message in client.chat_completion(
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
|
|
|
| 36 |
):
|
| 37 |
token = message.choices[0].delta.content
|
| 38 |
|
| 39 |
response += token
|
| 40 |
yield response
|
| 41 |
|
|
|
|
| 42 |
"""
|
| 43 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
| 44 |
"""
|
| 45 |
demo = gr.ChatInterface(
|
|
|
|
| 46 |
respond,
|
| 47 |
additional_inputs=[
|
| 48 |
gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
|
|
@@ -58,6 +63,5 @@ demo = gr.ChatInterface(
|
|
| 58 |
],
|
| 59 |
)
|
| 60 |
|
| 61 |
-
|
| 62 |
if __name__ == "__main__":
|
| 63 |
-
demo.launch()
|
|
|
|
| 6 |
"""
|
| 7 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
| 8 |
|
| 9 |
+
title = "rahul7star bot"
|
| 10 |
+
|
| 11 |
|
| 12 |
def respond(
|
| 13 |
+
message,
|
| 14 |
+
history: list[tuple[str, str]],
|
| 15 |
+
system_message,
|
| 16 |
+
max_tokens,
|
| 17 |
+
temperature,
|
| 18 |
+
top_p,
|
| 19 |
):
|
| 20 |
messages = [{"role": "system", "content": system_message}]
|
| 21 |
|
|
|
|
| 30 |
response = ""
|
| 31 |
|
| 32 |
for message in client.chat_completion(
|
| 33 |
+
title,
|
| 34 |
+
messages,
|
| 35 |
+
max_tokens=max_tokens,
|
| 36 |
+
stream=True,
|
| 37 |
+
temperature=temperature,
|
| 38 |
+
top_p=top_p,
|
| 39 |
):
|
| 40 |
token = message.choices[0].delta.content
|
| 41 |
|
| 42 |
response += token
|
| 43 |
yield response
|
| 44 |
|
| 45 |
+
|
| 46 |
"""
|
| 47 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
| 48 |
"""
|
| 49 |
demo = gr.ChatInterface(
|
| 50 |
+
title,
|
| 51 |
respond,
|
| 52 |
additional_inputs=[
|
| 53 |
gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
|
|
|
|
| 63 |
],
|
| 64 |
)
|
| 65 |
|
|
|
|
| 66 |
if __name__ == "__main__":
|
| 67 |
+
demo.launch()
|