Spaces:
Build error
Build error
Update gradio1final.py
Browse files- gradio1final.py +20 -18
gradio1final.py
CHANGED
|
@@ -24,15 +24,26 @@ from langchain import OpenAI
|
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
-
os.environ['GOOGLE_API_KEY'] = 'AIzaSyDLwJAr5iXL2Weaw1XphFNSeijytqOSbDg'
|
| 28 |
-
os.environ['OPENAI_API_KEY'] = 'sk-proj-Kh4UIWkfDxSGppQpooxXT3BlbkFJATohXqhpkJE6MqliIkmU'
|
| 29 |
-
# Set your API keys
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
openai.api_key = OPENAI_API_KEY
|
| 34 |
-
genai.configure(api_key=GOOGLE_API_KEY)
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
|
| 38 |
|
|
@@ -588,9 +599,8 @@ def process_gradio(query, model_type):
|
|
| 588 |
except Exception as e:
|
| 589 |
# Ensure the function still returns four values, even in case of an error
|
| 590 |
return {}, str(e), "", []
|
| 591 |
-
|
| 592 |
-
image_path = r"C:\Users\shivanshu.t\Downloads\incedo-logo.png"
|
| 593 |
|
|
|
|
| 594 |
|
| 595 |
with gr.Blocks() as demo:
|
| 596 |
with gr.Row():
|
|
@@ -598,16 +608,8 @@ with gr.Blocks() as demo:
|
|
| 598 |
# Add the image in the left corner
|
| 599 |
# gr.Image(value=image_path, show_label=False, height=45, width=45)
|
| 600 |
# gr.HTML(f'<img src="{image_link}" alt="Logo" height="50" width="50">')
|
| 601 |
-
|
| 602 |
# gr.HTML(f'<img src="{image_path}" alt="Logo" height="50" width="100" style="display: block; margin-left: auto; margin-right: auto;">')
|
| 603 |
-
# gr.HTML(f'<img src="https://mma.prnewswire.com/media/1807312/incedo_Logo.jpg" alt="Logo" height="50" width="80" style="display: block; margin-left: auto; margin-right: auto;">')
|
| 604 |
-
gr.HTML(
|
| 605 |
-
"""
|
| 606 |
-
<div style="text-align: left; padding: 10px;">
|
| 607 |
-
<img src="https://mma.prnewswire.com/media/1807312/incedo_Logo.jpg" alt="Logo" height="50" width="80">
|
| 608 |
-
</div>
|
| 609 |
-
"""
|
| 610 |
-
)
|
| 611 |
|
| 612 |
gr.Markdown(
|
| 613 |
"""
|
|
|
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
+
# os.environ['GOOGLE_API_KEY'] = 'AIzaSyDLwJAr5iXL2Weaw1XphFNSeijytqOSbDg'
|
| 28 |
+
# os.environ['OPENAI_API_KEY'] = 'sk-proj-Kh4UIWkfDxSGppQpooxXT3BlbkFJATohXqhpkJE6MqliIkmU'
|
| 29 |
+
# # Set your API keys
|
| 30 |
+
|
| 31 |
+
# OPENAI_API_KEY = 'sk-proj-Kh4UIWkfDxSGppQpooxXT3BlbkFJATohXqhpkJE6MqliIkmU'
|
| 32 |
+
# GOOGLE_API_KEY = 'AIzaSyDLwJAr5iXL2Weaw1XphFNSeijytqOSbDg'
|
| 33 |
+
# openai.api_key = OPENAI_API_KEY
|
| 34 |
+
# genai.configure(api_key=GOOGLE_API_KEY)
|
| 35 |
+
|
| 36 |
|
| 37 |
+
google_api_key = os.environ.get('GOOGLE_API_KEY')
|
| 38 |
+
openai_api_key = os.environ.get('OPENAI_API_KEY')
|
|
|
|
|
|
|
| 39 |
|
| 40 |
+
# Ensure that the API keys are set
|
| 41 |
+
if not google_api_key or not openai_api_key:
|
| 42 |
+
raise ValueError("API keys for Google and OpenAI must be set as environment variables.")
|
| 43 |
+
|
| 44 |
+
# Set your API keys
|
| 45 |
+
openai.api_key = openai_api_key
|
| 46 |
+
genai.configure(api_key=google_api_key)
|
| 47 |
|
| 48 |
|
| 49 |
|
|
|
|
| 599 |
except Exception as e:
|
| 600 |
# Ensure the function still returns four values, even in case of an error
|
| 601 |
return {}, str(e), "", []
|
|
|
|
|
|
|
| 602 |
|
| 603 |
+
image_path = r"C:\Users\shivanshu.t\Downloads\incedo-logo.png"
|
| 604 |
|
| 605 |
with gr.Blocks() as demo:
|
| 606 |
with gr.Row():
|
|
|
|
| 608 |
# Add the image in the left corner
|
| 609 |
# gr.Image(value=image_path, show_label=False, height=45, width=45)
|
| 610 |
# gr.HTML(f'<img src="{image_link}" alt="Logo" height="50" width="50">')
|
| 611 |
+
gr.Image(value=image_path, show_label=False, height=50, width=50)
|
| 612 |
# gr.HTML(f'<img src="{image_path}" alt="Logo" height="50" width="100" style="display: block; margin-left: auto; margin-right: auto;">')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 613 |
|
| 614 |
gr.Markdown(
|
| 615 |
"""
|