curiouscurrent commited on
Commit
536d419
·
verified ·
1 Parent(s): bf82c59

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -8
app.py CHANGED
@@ -1,3 +1,6 @@
 
 
 
1
  from transformers import AutoTokenizer, AutoModelForCausalLM
2
 
3
  # Load model directly
@@ -24,11 +27,11 @@ def generate_response(prompt, max_length=150, temperature=1.0):
24
  return response
25
 
26
 
27
- if __name__ == "__main__":
28
- while True:
29
- user_input = input("You: ")
30
- if not user_input: # Check if user input is empty
31
- print("Exiting OmniCode. Thank you for using me!")
32
- break
33
- response = generate_response(user_input)
34
- print("OmniCode:", response)
 
1
+ import gradio as gr
2
+
3
+ # Importing the required libraries
4
  from transformers import AutoTokenizer, AutoModelForCausalLM
5
 
6
  # Load model directly
 
27
  return response
28
 
29
 
30
+ # Create Gradio interface
31
+ def chat_with_omnicode(prompt):
32
+ response = generate_response(prompt)
33
+ return response
34
+
35
+
36
+ iface = gr.Interface(fn=chat_with_omnicode, inputs="text", outputs="text", title="OmniCode")
37
+ iface.launch()