hershey50 commited on
Commit
28358c5
·
verified ·
1 Parent(s): 905efe4

Delete protocol_generator.py

Browse files
Files changed (1) hide show
  1. protocol_generator.py +0 -53
protocol_generator.py DELETED
@@ -1,53 +0,0 @@
1
- import tkinter as tk
2
- from tkinter import messagebox
3
- import requests
4
-
5
- def generate_protocol():
6
- # Get the user input from the text box
7
- user_input = input_text.get("1.0", tk.END).strip()
8
-
9
- # Make a request to the Claude AI API to generate the protocol
10
- api_key = "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"
11
- api_url = "https://api.anthropic.com/v1/complete"
12
-
13
- headers = {
14
- "Content-Type": "application/json",
15
- "X-API-Key": api_key
16
- }
17
-
18
- data = {
19
- "prompt": f"Generate an Opentrons Flex protocol based on the following requirements:\n{user_input}",
20
- "model": "claude-v1",
21
- "max_tokens_to_sample": 1000
22
- }
23
-
24
- response = requests.post(api_url, headers=headers, json=data)
25
-
26
- if response.status_code == 200:
27
- protocol_code = response.json()["completion"]
28
-
29
- # Save the generated protocol as a Python file
30
- with open("generated_protocol.py", "w") as file:
31
- file.write(protocol_code)
32
-
33
- messagebox.showinfo("Success", "Protocol generated successfully!")
34
- else:
35
- messagebox.showerror("Error", "Failed to generate the protocol.")
36
-
37
- # Create the main window
38
- window = tk.Tk()
39
- window.title("Opentrons Flex Protocol Generator")
40
-
41
- # Create the input label and text box
42
- input_label = tk.Label(window, text="Enter protocol requirements:")
43
- input_label.pack()
44
-
45
- input_text = tk.Text(window, height=10, width=50)
46
- input_text.pack()
47
-
48
- # Create the generate button
49
- generate_button = tk.Button(window, text="Generate Protocol", command=generate_protocol)
50
- generate_button.pack()
51
-
52
- # Run the main event loop
53
- window.mainloop()