Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -29,8 +29,8 @@ class XylariaChat:
|
|
29 |
raise ValueError("HuggingFace token not found in environment variables")
|
30 |
|
31 |
self.client = InferenceClient(
|
32 |
-
model="mistralai/Mistral-Nemo-Instruct-2407",
|
33 |
-
token=self.hf_token
|
34 |
)
|
35 |
|
36 |
self.image_api_url = "https://api-inference.huggingface.co/models/Salesforce/blip-image-captioning-large"
|
@@ -95,7 +95,6 @@ class XylariaChat:
|
|
95 |
"photosynthesis": "process used by plants to convert light to energy"
|
96 |
}
|
97 |
|
98 |
-
# Initialize chat history file in the client's local storage
|
99 |
self.chat_history_file = "chat_history.json"
|
100 |
|
101 |
|
@@ -626,7 +625,6 @@ class XylariaChat:
|
|
626 |
|
627 |
def create_interface(self):
|
628 |
def streaming_response(message, chat_history, image_filepath, math_ocr_image_path):
|
629 |
-
# Placeholder for image generation
|
630 |
loading_svg = """<svg width="256" height="256" viewBox="0 0 256 256" xmlns="http://www.w3.org/2000/svg">
|
631 |
<style>
|
632 |
rect {
|
@@ -722,11 +720,6 @@ class XylariaChat:
|
|
722 |
full_response += chunk.token.text
|
723 |
updated_history[-1][1] = full_response
|
724 |
|
725 |
-
|
726 |
-
|
727 |
-
#self.conversation_history.append(ChatMessage(role="user", content=message).to_dict())
|
728 |
-
#self.conversation_history.append(ChatMessage(role="assistant", content=full_response).to_dict())
|
729 |
-
|
730 |
yield "", updated_history, None, None, None
|
731 |
|
732 |
except Exception as e:
|
|
|
29 |
raise ValueError("HuggingFace token not found in environment variables")
|
30 |
|
31 |
self.client = InferenceClient(
|
32 |
+
model="mistralai/Mistral-Nemo-Instruct-2407",
|
33 |
+
token=self.hf_token
|
34 |
)
|
35 |
|
36 |
self.image_api_url = "https://api-inference.huggingface.co/models/Salesforce/blip-image-captioning-large"
|
|
|
95 |
"photosynthesis": "process used by plants to convert light to energy"
|
96 |
}
|
97 |
|
|
|
98 |
self.chat_history_file = "chat_history.json"
|
99 |
|
100 |
|
|
|
625 |
|
626 |
def create_interface(self):
|
627 |
def streaming_response(message, chat_history, image_filepath, math_ocr_image_path):
|
|
|
628 |
loading_svg = """<svg width="256" height="256" viewBox="0 0 256 256" xmlns="http://www.w3.org/2000/svg">
|
629 |
<style>
|
630 |
rect {
|
|
|
720 |
full_response += chunk.token.text
|
721 |
updated_history[-1][1] = full_response
|
722 |
|
|
|
|
|
|
|
|
|
|
|
723 |
yield "", updated_history, None, None, None
|
724 |
|
725 |
except Exception as e:
|