Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,7 +4,7 @@ import gradio as gr
|
|
| 4 |
import google.generativeai as genai
|
| 5 |
import os
|
| 6 |
import time
|
| 7 |
-
|
| 8 |
|
| 9 |
load_dotenv(find_dotenv())
|
| 10 |
|
|
@@ -13,6 +13,9 @@ genai.configure(api_key=os.environ["GEMINI_API_KEY"])
|
|
| 13 |
|
| 14 |
conversation_history=[]
|
| 15 |
|
|
|
|
|
|
|
|
|
|
| 16 |
def generate_trip_plan(user_input):
|
| 17 |
|
| 18 |
system_instruction = """
|
|
@@ -56,7 +59,7 @@ def generate_trip_plan(user_input):
|
|
| 56 |
response=chat_session.send_message(user_input)
|
| 57 |
print("Response:",response.text)
|
| 58 |
recommendations=response.text.strip()
|
| 59 |
-
plain_text_recommendations=
|
| 60 |
|
| 61 |
conversation_history.append({"role": "assistant","parts": [plain_text_recommendations]})
|
| 62 |
return plain_text_recommendations
|
|
|
|
| 4 |
import google.generativeai as genai
|
| 5 |
import os
|
| 6 |
import time
|
| 7 |
+
import re
|
| 8 |
|
| 9 |
load_dotenv(find_dotenv())
|
| 10 |
|
|
|
|
| 13 |
|
| 14 |
conversation_history=[]
|
| 15 |
|
| 16 |
+
def strip_html_tags(text):
|
| 17 |
+
return re.sub(r'<[^>]*>','',text)
|
| 18 |
+
|
| 19 |
def generate_trip_plan(user_input):
|
| 20 |
|
| 21 |
system_instruction = """
|
|
|
|
| 59 |
response=chat_session.send_message(user_input)
|
| 60 |
print("Response:",response.text)
|
| 61 |
recommendations=response.text.strip()
|
| 62 |
+
plain_text_recommendations=strip_html_tags(recommendations)
|
| 63 |
|
| 64 |
conversation_history.append({"role": "assistant","parts": [plain_text_recommendations]})
|
| 65 |
return plain_text_recommendations
|