main #4
4 changed files with 25 additions and 3 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +1,2 @@
|
|||
venv/
|
||||
__pycache__
|
||||
|
|
|
@ -29,8 +29,7 @@ class API:
|
|||
response_data.append(line_raw["response"])
|
||||
|
||||
final_response = "".join(response_data)
|
||||
generated_text = final_response.splitlines()[-1]
|
||||
return generated_text
|
||||
return final_response
|
||||
else:
|
||||
return "Error: " + response.text
|
||||
|
||||
|
@ -47,4 +46,4 @@ class API:
|
|||
answer = self.process_text_transformers(message, "meta-llama/Meta-Llama-3.1-8B")
|
||||
else:
|
||||
return "Invalid choice"
|
||||
return answer
|
||||
return answer
|
20
py/simple_chat.py
Normal file
20
py/simple_chat.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
from api import API
|
||||
|
||||
chat1 = API()
|
||||
|
||||
while True:
|
||||
print("")
|
||||
print("Which AI Model do you want to use? Write as a Number (1-5)")
|
||||
model_input = input()
|
||||
model = int(model_input)
|
||||
if model <=0 or model > 5:
|
||||
print("ungültiges Modell")
|
||||
continue
|
||||
while True:
|
||||
print("")
|
||||
print("Ask a question")
|
||||
inputText = input ()
|
||||
if inputText == "change":
|
||||
break
|
||||
outputText = chat1.send_message(inputText, model)
|
||||
print(outputText)
|
|
@ -1,5 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
rm -rf venv/
|
||||
virtualenv venv
|
||||
source venv/bin/activate
|
||||
pip install transformers
|
||||
pip install torch
|
||||
|
|
Loading…
Reference in a new issue