VishalMysore commited on
Commit
b501ded
1 Parent(s): dc192b2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -43
app.py CHANGED
@@ -95,7 +95,7 @@ def askllmpipe(text):
95
  def answer(text):
96
  return "I want to eat raw salad with lots of onion"
97
 
98
- def callchain(recipe , dropdown_input, vegetarian,calories):
99
  language_mapping = {"English": "eng_Latn", "Hindi": "hin_Deva", "Tamil": "tam_Taml","Gujarati":"guj_Gujr","Telugu":"tel_Telu"}
100
  # Get the mapped value for the selected language
101
  selected_language = language_mapping.get(dropdown_input, "")
@@ -106,46 +106,34 @@ def callchain(recipe , dropdown_input, vegetarian,calories):
106
  return output_text
107
 
108
  html_content = read_html_file("cookgpt.html")
109
- description="CookGPT is an innovative AI-based chef that combines the charm of traditional cooking with the efficiency of modern technology. Whether you're a culinary enthusiast, a busy professional, or someone looking for culinary inspiration, CookGPT is designed to make your cooking experience delightful, personalized, and effortless."
110
- iface = gr.Interface(
111
- fn=callchain,
112
- inputs=[
113
- gr.Textbox("Provide a recipe for paneer butter masala"),
114
- gr.Dropdown(["English", "Hindi", "Tamil","Gujarati","Telugu"], label="Language"),
115
- gr.Checkbox("Vegetarian"),
116
- gr.Checkbox("Low Calories")
117
- ],
118
- outputs=gr.Textbox("Details will appear here"),allow_flagging="never",
119
- title="Welcome to CookGPT",
120
- description=description,article=html_content,
121
- live=False,examples=[
122
- ["Provide recipe for Paneer Butter Masala!","Tamil",True,True],
123
- ["Provide a receipe for Malai Kofta.","Hindi",False,True],["Provide a receipe for Soya Chap.","Telugu",False,True],["Provide a receipe for Aloo Saag.","Gujarati",False,True],
124
- ["Provide a receipe for Aloo Matar.","Tamil",False,True],["Provide a new receipe based on tomato and potato","Telugu",False,True]
125
- ],cache_examples=False
126
- )
 
 
 
 
 
 
 
 
 
 
 
127
 
128
- descriptionAddRecipe="Users will have the capability to contribute their custom recipes by either adding them manually or uploading video content. These recipes will be subject to upvoting by other users, and those receiving positive feedback will be scheduled for fine-tuning our Language Model (LLM). This collaborative approach allows the community to actively participate in refining and enhancing the model based on the most appreciated and valued recipes."
129
- addRecipeIface = gr.Interface(
130
- fn=answer,
131
- inputs=[
132
- gr.Textbox("Add/Record Your custom Recipe here")],
133
- outputs=gr.Textbox("Details will appear here"),allow_flagging="never",
134
- description=descriptionAddRecipe,article=html_content,
135
- title="Add Your Recipe"
136
- )
137
-
138
- descriptionFineTune="Finetuning Parameters Customization"
139
- fineTuneIface = gr.Interface(
140
- fn=answer,
141
- inputs=[
142
- gr.Textbox("Send Finetune Request")],
143
- outputs=gr.Textbox("Details will appear here"),allow_flagging="never",
144
- description=descriptionFineTune,article=html_content,
145
- title="Finetune the model"
146
- )
147
-
148
- demo = gr.TabbedInterface([iface,addRecipeIface,fineTuneIface], ["Find Recipe","Add Recipe","Finetune"])
149
-
150
- if __name__ == "__main__":
151
- demo.launch()
 
95
  def answer(text):
96
  return "I want to eat raw salad with lots of onion"
97
 
98
+ def callchain(recipe , dropdown_input):
99
  language_mapping = {"English": "eng_Latn", "Hindi": "hin_Deva", "Tamil": "tam_Taml","Gujarati":"guj_Gujr","Telugu":"tel_Telu"}
100
  # Get the mapped value for the selected language
101
  selected_language = language_mapping.get(dropdown_input, "")
 
106
  return output_text
107
 
108
  html_content = read_html_file("cookgpt.html")
109
+ descriptionFindRecipe="## Welcome to CookGPT\n CookGPT is an innovative AI-based chef that combines the charm of traditional cooking with the efficiency of modern technology. Whether you're a culinary enthusiast, a busy professional, or someone looking for culinary inspiration, CookGPT is designed to make your cooking experience delightful, personalized, and effortless."
110
+ descriptionAddRecipe="## what your favorite? \n Users will have the capability to contribute their custom recipes by either adding them manually or uploading video content. These recipes will be subject to upvoting by other users, and those receiving positive feedback will be scheduled for fine-tuning our Language Model (LLM). This collaborative approach allows the community to actively participate in refining and enhancing the model based on the most appreciated and valued recipes."
111
+ descriptionFineTune="## Miss something \n Finetuning Parameters Customization, we will keep rebuilding the based model untill all the recipes are covered"
112
+ with gr.Blocks() as demo:
113
+ with gr.Tab("Find Recipe"):
114
+ gr.Markdown(descriptionFindRecipe)
115
+ findRecipeText = gr.Textbox(label="Recipe Query",info="What do you want to eat today!")
116
+ language =gr.Dropdown(
117
+ ["English", "Hindi", "Tamil", "Telugu", "Gujarati"], label="Languge", value="Hindi",info="Select your desired Language!"
118
+ )
119
+ findbtn = gr.Button(value="Find Recipe")
120
+ findRecipeTextOutPut = gr.Textbox(label="Recipe Details")
121
+ findbtn.click(callchain, inputs=[findRecipeText],outputs=[findRecipeTextOutPut])
122
+ examples = gr.Examples(examples=[["Provide me Recipe for Paneer Butter Masala.","Tamil"], ["Provide me a Recipe for Aloo Kofta.","Hindi"]],
123
+ inputs=[findRecipeText,language])
124
+ gr.HTML(html_content)
125
+
126
+ with gr.Tab("Add Recipe"):
127
+ gr.Markdown(descriptionAddRecipe)
128
+ addRecipe = gr.Textbox(label="Add Your Recipe",info="Favorite dish made by your Grandma!")
129
+ formatedRecipe = gr.Textbox(label="Formated Recipe",info="Format the Recipe!")
130
+ btn = gr.Button(value="Format Recipe")
131
+ btn.click(answer, inputs=[addRecipe],outputs=[formatedRecipe])
132
+ gr.HTML(html_content)
133
+
134
+ with gr.Tab("Fine Tune The model"):
135
+ gr.Markdown(descriptionFineTune)
136
+ btn = gr.Button(value="View Finetuning Dataset")
137
+ gr.HTML(html_content)
138
 
139
+ demo.launch()