Downloads · 30 days
0
Moulis/Genrative_AI_1
Genrative_AI_1 is a machine learning model from Moulis. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Downloads · 30 days
0
Access
Public
Updated Sep 20, 2024
Repo size
—
Likes
0
Public
Click a slice to open those files.
Other1.5 KB · 58%
From the Hugging Face model README
import openai
openai.api_key = 'YOUR_OPENAI_API_KEY'
def chat_with_scientist(prompt): """ This function takes a user's input and returns a response from the generative AI, pretending to be a science scientist. """ response = openai.Completion.create( engine="text-davinci-003", # GPT-3.5 or change to "gpt-4" for GPT-4 model prompt=prompt, max_tokens=150, n=1, stop=None, temperature=0.7, # Higher value for more creative responses ) return response.choices[0].text.strip()
def start_chat(): print("AI Scientist: Hello! I am a scientist. Ask me any science-related questions.") while True: user_input = input("You: ") if user_input.lower() in ["exit", "quit"]: print("AI Scientist: Goodbye!") break prompt = f"You are a knowledgeable scientist. Answer the following science question in detail: {user_input}" reply = chat_with_scientist(prompt) print(f"AI Scientist: {reply}\n")
if name == "main": start_chat()