stefanches7 commited on
Commit
ba7c80f
·
2 Parent(s): cd91161 90df45b

Merge branch 'main' of https://github.com/stefanches7/AI-assisted-Neuroimaging-harmonization

Browse files
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ /Non_Bids_Dataset
LM_Studio_chat.py ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+ import json
3
+
4
+ url = "http://localhost:1234/v1/chat/completions"
5
+ headers = {
6
+ "Content-Type": "application/json"
7
+ }
8
+
9
+ # Initialize conversation history with the system message
10
+ conversation_history = [
11
+ {
12
+ "role": "system",
13
+ "content": "Be a helpful assistant. Be concise."
14
+ }
15
+ ]
16
+
17
+ while True:
18
+ # Get user input
19
+ user_input = input("You: ")
20
+
21
+ # Exit the loop if the user types 'exit'
22
+ if user_input.lower() == 'exit':
23
+ print("Ending conversation...")
24
+ break
25
+
26
+ # Add user's message to the conversation history
27
+ conversation_history.append({
28
+ "role": "user",
29
+ "content": user_input
30
+ })
31
+
32
+ # Prepare the data for the API call
33
+ data = {
34
+ "model": "deepseek/deepseek-r1-0528-qwen3-8b",
35
+ "messages": conversation_history,
36
+ "temperature": 0.7,
37
+ "max_tokens": -1,
38
+ "stream": False
39
+ }
40
+
41
+ # Make the POST request to the API
42
+ response = requests.post(url, headers=headers, data=json.dumps(data))
43
+
44
+ # Get the model's response
45
+ model_response = response.json()
46
+
47
+ # Extract and print the last model response (the assistant's content)
48
+ last_message = model_response['choices'][0]['message']['content']
49
+ print(f"Model: {last_message}")
50
+
51
+ # Add model's response to the conversation history for the next round
52
+ conversation_history.append({
53
+ "role": "assistant",
54
+ "content": last_message
55
+ })
__pycache__/agent.cpython-314.pyc ADDED
Binary file (4.11 kB). View file