tonyliu404 commited on
Commit
3ebf075
·
verified ·
1 Parent(s): 13f2313

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -46
app.py CHANGED
@@ -156,19 +156,17 @@ Use the provided context to generate a result based on the following JSON format
156
  Instructions:
157
  1. Focus on the user's specific request and avoid irrelevant ingredients or approaches.
158
  2. Do not return anything other than the JSON.
159
- 3. If the answer is unclear or the context does not fully address the prompt, return [].
160
  4. Base the response on simple, healthy, and accessible ingredients and techniques.
161
  5. Rewrite the description in third person
162
- 6. If context does not match {question} at all, return []
163
- 7. Include the ingredient amounts and say them in the steps.
164
 
165
  When choosing a recipe from the context, FOLLOW these instructions:
166
- 0. If context does not match {question} at all, return []
167
  1. The recipe should be makeable from scratch, using only proper ingredients and not other dishes or pre-made recipes
168
  2. If the recipes from the context makes sense but do not match {question}, generate an amazing, specific recipe for {question}
169
  with precise steps and measurements. Take some inspiration from context if availab.e
170
  3. Following the above template.
171
- 4. If context does not match {question} at all, return []
172
 
173
 
174
  Context: {context}
@@ -335,47 +333,6 @@ def display_prediction_graph(class_names, confidences):
335
  # Display the chart in Streamlit
336
  st.plotly_chart(fig)
337
 
338
- # def display_prediction_graph(class_names, confidences):
339
- # #reversing them so graph displays highest predictions at the top
340
- # confidences.reverse()
341
- # class_names.reverse()
342
-
343
- # #display as a graph
344
- # norm = plt.Normalize(min(confidences), max(confidences))
345
- # cmap = LinearSegmentedColormap.from_list("grey_orange", ["#808080", "#FFA500"]) #color map grey to orange
346
-
347
- # fig, ax = plt.subplots(figsize=(12, 6))
348
- # bars = ax.barh(class_names, confidences, color=cmap(norm(confidences)))
349
-
350
- # fig.patch.set_alpha(0) # Transparent background
351
- # ax.set_facecolor('none')
352
-
353
- # min_width = 0.07 * ax.get_xlim()[1] # 7% of the x-axis range
354
- # # Add labels inside the bars, aligned to the right
355
- # for bar in bars:
356
- # original_width = bar.get_width()
357
- # width = original_width
358
- # if width < min_width:
359
- # width = min_width
360
- # ax.text(width - 0.02, bar.get_y() + bar.get_height()/2, f'{original_width:.1f}%',
361
- # va='center', ha='right', color='white', fontweight='bold', fontsize=16)
362
-
363
- # ax.set_xticklabels([]) #remove x label
364
-
365
- # # Wrapping labels
366
- # max_label_width = 10
367
- # labels = ax.get_yticklabels()
368
- # wrapped_labels = [textwrap.fill(label.get_text(), width=max_label_width) for label in labels] # Wrap the labels if they exceed the max width
369
- # ax.set_yticklabels(wrapped_labels, fontsize=16, color='white')
370
-
371
- # #no borders
372
- # for spine in ax.spines.values():
373
- # spine.set_visible(False)
374
-
375
- # ax.set_title(class_names[-1], color='white', fontsize=24, fontweight='bold', ha='left', x=0.5)
376
-
377
- # st.pyplot(fig) # Display the plot
378
-
379
  # #Streamlit
380
 
381
  #Left sidebar title
 
156
  Instructions:
157
  1. Focus on the user's specific request and avoid irrelevant ingredients or approaches.
158
  2. Do not return anything other than the JSON.
159
+ 3. If the answer is unclear AND the context does not fully address the prompt, return [].
160
  4. Base the response on simple, healthy, and accessible ingredients and techniques.
161
  5. Rewrite the description in third person
162
+ 6. Include the ingredient amounts and say them in the steps.
 
163
 
164
  When choosing a recipe from the context, FOLLOW these instructions:
 
165
  1. The recipe should be makeable from scratch, using only proper ingredients and not other dishes or pre-made recipes
166
  2. If the recipes from the context makes sense but do not match {question}, generate an amazing, specific recipe for {question}
167
  with precise steps and measurements. Take some inspiration from context if availab.e
168
  3. Following the above template.
169
+ 4. If context does not match {question} in topic, return []
170
 
171
 
172
  Context: {context}
 
333
  # Display the chart in Streamlit
334
  st.plotly_chart(fig)
335
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
336
  # #Streamlit
337
 
338
  #Left sidebar title