darshil3011 commited on
Commit
d249abf
1 Parent(s): 3dcea72

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -8
app.py CHANGED
@@ -1,15 +1,11 @@
1
  import os
2
- from langchain.prompts import PromptTemplate
3
- from langchain.llms import OpenAI
4
  import gradio as gr
5
- import random
6
  import time
7
  from gradio_client import Client
8
 
9
- os.environ["OPENAI_API_KEY"] = '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'
10
 
11
 
12
- def get_response(query, history, llm):
13
 
14
  client = Client("https://traversaal-fitx-ai.hf.space/")
15
  result = client.predict(
@@ -21,7 +17,6 @@ def get_response(query, history, llm):
21
  return result
22
 
23
 
24
- llm = prepare_resources()
25
 
26
  custom_css = """
27
  <style>
@@ -65,9 +60,9 @@ def respond(message, chat_history):
65
  if not chat_history:
66
  # Display a welcome message if chat_history is empty
67
  welcome_message = "Welcome to the AI Trainer Chatbot! I'm here to assist you with your questions."
68
- chat_history = [(welcome_message, get_response(welcome_message, chat_history, llm))]
69
 
70
- bot_message = get_response(message, chat_history, llm)
71
  chat_history.append(bot_message)
72
  time.sleep(0.5)
73
  return "", chat_history
 
1
  import os
 
 
2
  import gradio as gr
 
3
  import time
4
  from gradio_client import Client
5
 
 
6
 
7
 
8
+ def get_response(query, history):
9
 
10
  client = Client("https://traversaal-fitx-ai.hf.space/")
11
  result = client.predict(
 
17
  return result
18
 
19
 
 
20
 
21
  custom_css = """
22
  <style>
 
60
  if not chat_history:
61
  # Display a welcome message if chat_history is empty
62
  welcome_message = "Welcome to the AI Trainer Chatbot! I'm here to assist you with your questions."
63
+ chat_history = [(welcome_message, get_response(welcome_message, chat_history))]
64
 
65
+ bot_message = get_response(message, chat_history)
66
  chat_history.append(bot_message)
67
  time.sleep(0.5)
68
  return "", chat_history