-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkivyTerminalAgent.py
41 lines (29 loc) · 1.27 KB
/
kivyTerminalAgent.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import subprocess
from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
from kivy.uix.textinput import TextInput
class MyApp(App):
def build(self):
layout = BoxLayout(orientation='vertical')
# Create a label to display information
label1 = Label(text='This is my Llama agent')
# Create a TextInput widget to ask for user input
# I want to know more abut private agents
text_input = TextInput(hint_text='Enter your text here', multiline=False)
# Create a button that will handle user interaction
button = Button(text='Submit')
# Define what happens when the button is pressed
def on_button_press(instance):
user_text = text_input.text # Get the text entered by the user
# Call the second Python file with the user input as an argument
subprocess.run(['python3', 'llamaAgent.py', user_text])
button.bind(on_press=on_button_press) # Bind the button press event to the function
# Add widgets to the layout
layout.add_widget(label1)
layout.add_widget(text_input)
layout.add_widget(button)
return layout
if __name__ == '__main__':
MyApp().run()