amaltese commited on
Commit
55a936b
·
verified ·
1 Parent(s): b3035c0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -1,9 +1,9 @@
1
  import streamlit as st
2
  import requests
3
  import wikipediaapi
4
- import os # Import for accessing environment variables
5
 
6
- # Fetch Hugging Face API key securely from environment variables
7
  HUGGINGFACE_API_KEY = os.getenv("HUGGINGFACE_API_KEY")
8
 
9
  if not HUGGINGFACE_API_KEY:
@@ -24,9 +24,9 @@ def chat_with_ai(person_name, user_input):
24
  context = get_wikipedia_summary(person_name)
25
  prompt = f"You are {person_name}. Based on this historical information: {context}\\n\\nUser: {user_input}\\n{person_name}:"
26
 
27
- API_URL = "https://api-inference.huggingface.co/models/mistralai/Mistral-7B"
28
  headers = {"Authorization": f"Bearer {HUGGINGFACE_API_KEY}"}
29
-
30
  response = requests.post(API_URL, headers=headers, json={"inputs": prompt})
31
 
32
  if response.status_code == 200:
 
1
  import streamlit as st
2
  import requests
3
  import wikipediaapi
4
+ import os # For accessing environment variables
5
 
6
+ # Securely fetch Hugging Face API key from environment variables
7
  HUGGINGFACE_API_KEY = os.getenv("HUGGINGFACE_API_KEY")
8
 
9
  if not HUGGINGFACE_API_KEY:
 
24
  context = get_wikipedia_summary(person_name)
25
  prompt = f"You are {person_name}. Based on this historical information: {context}\\n\\nUser: {user_input}\\n{person_name}:"
26
 
27
+ API_URL = "https://api-inference.huggingface.co/models/mistralai/Mistral-7B-Instruct-v0.1"
28
  headers = {"Authorization": f"Bearer {HUGGINGFACE_API_KEY}"}
29
+
30
  response = requests.post(API_URL, headers=headers, json={"inputs": prompt})
31
 
32
  if response.status_code == 200: