dipsmom commited on
Commit
a4fcf1f
·
verified ·
1 Parent(s): 953cc96

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -22
app.py CHANGED
@@ -1,33 +1,19 @@
1
 
2
  import streamlit as st
3
 
4
- streamlit run medicine_info_app.py
5
-
6
- from transformers import pipeline
7
-
8
- # Load the pre-trained model for text generation
9
- nlp = pipeline("text-generation", model="EleutherAI/gpt-neo-125M")
10
-
11
  # Define information about medicines (replace with real data)
12
  medicine_info = {
13
- "topic": {
14
- "composition": "topic primarily contains composition as its active ingredient.",
15
- "uses": "topic is commonly used to cure which disease.",
16
- "purpose": "topic is primarily used to cure various conditions."
17
  },
18
-
19
  # Add more medicines and their information as needed
20
  }
21
 
22
  def get_medicine_info(medicine_name):
23
  return medicine_info.get(medicine_name.lower())
24
 
25
- def generate_medicine_info(medicine_name):
26
- # For simplicity, we'll generate a response using a pre-trained language model
27
- prompt = f"Provide information about {medicine_name} medicine."
28
- response = nlp(prompt, max_length=100)[0]['generated_text']
29
- return response
30
-
31
  def main():
32
  st.title("Medicine Information Finder")
33
 
@@ -47,13 +33,10 @@ def main():
47
  st.subheader("Purpose:")
48
  st.write(medicine_data["purpose"])
49
  else:
50
- # Generate information using a pre-trained language model
51
  st.error("Sorry, information about this medicine is not available.")
52
- st.info("Generating information using a pre-trained model...")
53
- generated_info = generate_medicine_info(medicine_name)
54
- st.write(generated_info)
55
  elif submitted and not medicine_name:
56
  st.error("Please provide the name of the medicine.")
57
 
58
  if __name__ == "__main__":
59
  main()
 
 
1
 
2
  import streamlit as st
3
 
 
 
 
 
 
 
 
4
  # Define information about medicines (replace with real data)
5
  medicine_info = {
6
+ "aspirin": {
7
+ "composition": "Aspirin primarily contains acetylsalicylic acid as its active ingredient.",
8
+ "uses": "Aspirin is commonly used to reduce pain, inflammation, and fever.",
9
+ "purpose": "Aspirin is primarily used to treat headaches, muscle pain, and arthritis."
10
  },
 
11
  # Add more medicines and their information as needed
12
  }
13
 
14
  def get_medicine_info(medicine_name):
15
  return medicine_info.get(medicine_name.lower())
16
 
 
 
 
 
 
 
17
  def main():
18
  st.title("Medicine Information Finder")
19
 
 
33
  st.subheader("Purpose:")
34
  st.write(medicine_data["purpose"])
35
  else:
 
36
  st.error("Sorry, information about this medicine is not available.")
 
 
 
37
  elif submitted and not medicine_name:
38
  st.error("Please provide the name of the medicine.")
39
 
40
  if __name__ == "__main__":
41
  main()
42
+