Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -1968,6 +1968,24 @@ Question: {question}<|end|>
|
|
1968 |
Sure! The Responses are as follows:
|
1969 |
"""
|
1970 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1971 |
|
1972 |
def generate_bot_response(history, choice, retrieval_mode, model_choice):
|
1973 |
if not history:
|
@@ -2129,19 +2147,6 @@ Sure! Here is the response for your Query:
|
|
2129 |
|
2130 |
return final_response
|
2131 |
|
2132 |
-
|
2133 |
-
|
2134 |
-
|
2135 |
-
|
2136 |
-
|
2137 |
-
|
2138 |
-
|
2139 |
-
|
2140 |
-
|
2141 |
-
|
2142 |
-
|
2143 |
-
|
2144 |
-
|
2145 |
# Define a new template specifically for GPT-4o-mini in VDB Details mode
|
2146 |
gpt4o_mini_template_details = f"""
|
2147 |
As a highly specialized assistant, I provide precise, detailed, and informative responses. On this bright day of {current_date}, I'm equipped to assist with all your queries about Birmingham, Alabama, offering detailed insights tailored to your needs.
|
@@ -2150,8 +2155,9 @@ Given your request, here is the detailed information you're seeking:
|
|
2150 |
Question: {{question}}
|
2151 |
Detailed Answer:
|
2152 |
"""
|
2153 |
-
|
2154 |
-
|
|
|
2155 |
|
2156 |
import traceback
|
2157 |
|
@@ -3166,7 +3172,12 @@ with gr.Blocks(theme='gradio/soft') as demo:
|
|
3166 |
# refresh_button = gr.Button("Refresh Images")
|
3167 |
# refresh_button.click(fn=update_images, inputs=None, outputs=[image_output_1, image_output_2, image_output_3])
|
3168 |
|
|
|
|
|
|
|
3169 |
|
|
|
|
|
3170 |
|
3171 |
|
3172 |
|
|
|
1968 |
Sure! The Responses are as follows:
|
1969 |
"""
|
1970 |
|
1971 |
+
#phi-dataframe creation
|
1972 |
+
|
1973 |
+
# Extract information using regex (assuming response format as given above)
|
1974 |
+
doc_names = re.findall(r'Document name: (.+)', phi_response)
|
1975 |
+
page_numbers = re.findall(r'Page No: (\d+)', phi_response)
|
1976 |
+
responses = re.findall(r'Response: (.+)', phi_response)
|
1977 |
+
|
1978 |
+
# Create a DataFrame with the extracted information
|
1979 |
+
data = {'Document Name': doc_names[:3], 'Page Number': page_numbers[:3], 'Top 3 Responses': responses[:3]}
|
1980 |
+
df = pd.DataFrame(data)
|
1981 |
+
|
1982 |
+
return df
|
1983 |
+
|
1984 |
+
# Function to display the table based on the Phi-3.5 response
|
1985 |
+
def display_phi_table(input_prompt):
|
1986 |
+
df = generate_phi_response(input_prompt)
|
1987 |
+
return df
|
1988 |
+
|
1989 |
|
1990 |
def generate_bot_response(history, choice, retrieval_mode, model_choice):
|
1991 |
if not history:
|
|
|
2147 |
|
2148 |
return final_response
|
2149 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2150 |
# Define a new template specifically for GPT-4o-mini in VDB Details mode
|
2151 |
gpt4o_mini_template_details = f"""
|
2152 |
As a highly specialized assistant, I provide precise, detailed, and informative responses. On this bright day of {current_date}, I'm equipped to assist with all your queries about Birmingham, Alabama, offering detailed insights tailored to your needs.
|
|
|
2155 |
Question: {{question}}
|
2156 |
Detailed Answer:
|
2157 |
"""
|
2158 |
+
#dataframe on gradio
|
2159 |
+
import pandas as pd
|
2160 |
+
import ace_tools as tools # For displaying the DataFrame in Gradio
|
2161 |
|
2162 |
import traceback
|
2163 |
|
|
|
3172 |
# refresh_button = gr.Button("Refresh Images")
|
3173 |
# refresh_button.click(fn=update_images, inputs=None, outputs=[image_output_1, image_output_2, image_output_3])
|
3174 |
|
3175 |
+
with gr.Column():
|
3176 |
+
# Add the DataFrame output for Phi-3.5 model responses
|
3177 |
+
dataframe_output = gr.DataFrame(label="Phi-3.5 Model Output", interactive=False)
|
3178 |
|
3179 |
+
# Show the DataFrame when the input is submitted
|
3180 |
+
chat_input.submit(display_phi_table, inputs=[chat_input], outputs=[dataframe_output])
|
3181 |
|
3182 |
|
3183 |
|