venkatl commited on
Commit
694665d
·
verified ·
1 Parent(s): c846ca5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -7
app.py CHANGED
@@ -1,17 +1,13 @@
1
  import pandas as pd
2
  import gradio as gr
3
 
4
- # Load your CSV data into a Pandas DataFrame (replace 'your_data.csv' with the actual file path)
5
  data = pd.read_csv('plant.csv')
6
 
7
- # Get unique values for botanical name and useful part
8
  botanical_names = list(data['Botanical Name'].unique())
9
  useful_parts = list(data['Useful Part'].unique())
10
 
11
- # Create a dictionary mapping (botanical_name, useful_part) to disease cured
12
  disease_dict = {(row['Botanical Name'], row['Useful Part']): row['Disease Cures'] for _, row in data.iterrows()}
13
 
14
- # Define the Gradio interface
15
  def predict_disease(botanical_name, useful_part):
16
  try:
17
  disease_cured = disease_dict[(botanical_name, useful_part)]
@@ -26,9 +22,8 @@ iface = gr.Interface(
26
  outputs="text",
27
  examples=[
28
  [botanical_names[0], useful_parts[0]],
29
- [botanical_names[1], useful_parts[1]],
30
- # Add more examples if needed
31
- ]
32
  )
33
 
34
  iface.launch()
 
1
  import pandas as pd
2
  import gradio as gr
3
 
 
4
  data = pd.read_csv('plant.csv')
5
 
 
6
  botanical_names = list(data['Botanical Name'].unique())
7
  useful_parts = list(data['Useful Part'].unique())
8
 
 
9
  disease_dict = {(row['Botanical Name'], row['Useful Part']): row['Disease Cures'] for _, row in data.iterrows()}
10
 
 
11
  def predict_disease(botanical_name, useful_part):
12
  try:
13
  disease_cured = disease_dict[(botanical_name, useful_part)]
 
22
  outputs="text",
23
  examples=[
24
  [botanical_names[0], useful_parts[0]],
25
+ ["Bixa Orellana", "Leaf"],
26
+ ], title = "Botanical Cure Finder"
 
27
  )
28
 
29
  iface.launch()