chukbert commited on
Commit
c7eaa5e
·
verified ·
1 Parent(s): 8602b5e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -34
app.py CHANGED
@@ -1,37 +1,3 @@
1
- # # Path: chatbot_model_based_autocorrect.py
2
- # import os, getpass
3
- # from langchain_openai import ChatOpenAI
4
- # from langchain_core.messages import HumanMessage
5
- # import gradio as gr
6
- # import openai
7
-
8
- # openai.api_key = os.getenv("OPENAI_API_KEY")
9
- # # Define the language model
10
- # model = ChatOpenAI(model="gpt-4o-mini")
11
-
12
- # # Function to generate a conversational response with model-based autocorrection
13
- # def chatbot_autocorrect_response(input_text: str):
14
- # # Step 1: Define the prompt asking the model to correct the sentence
15
- # prompt = (
16
- # f"The user said: '{input_text}'. Please correct this sentence if necessary, and make it sounds friendly, casual tone, acknowledging the correction and make it sounds like american native conversation. If appropriate, make it sounds like an IELTS 9.0 level response. If sentences are in Indonesian translate it and make it sounds like native american conversational. Please only respond with the corrected sentence. If nothing needs to be changed, repeat the sentence."
17
- # )
18
-
19
- # # Step 2: Send the prompt to the model
20
- # human_message = HumanMessage(content=prompt)
21
- # response = model.invoke([human_message])
22
-
23
- # # Step 3: Return the response from the model
24
- # return response.content
25
-
26
- # # Example usage
27
- # def gradio_chatbot(input_text):
28
- # # Pass the user's input to the chatbot function and get the response
29
- # return chatbot_autocorrect_response(input_text)
30
-
31
- # # Launch Gradio interface
32
- # interface = gr.Interface(fn=gradio_chatbot, inputs="text", outputs="text", title="Chatbot with Auto-Correction")
33
- # interface.launch()
34
-
35
  import os, getpass
36
  from langchain_openai import ChatOpenAI
37
  from langchain_core.messages import HumanMessage
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import os, getpass
2
  from langchain_openai import ChatOpenAI
3
  from langchain_core.messages import HumanMessage