Menu
Menu
DaniWeb
Log In
Sign Up
Read
Contribute
Meet
Search
Search
About 1,000 results for
def
- Page 1
Comparing Fine-tuned and Default GPT-3.5 Turbo for Text Classification
Programming
Computer Science
3 Days Ago
by usmanmalik57
…r"/home/mani/Datasets/Tweets.csv")
def
preprocess_data(dataset, n): # Remove rows where …Function to create the JSON structure for each row
def
create_json_structure(row): return { "messages": […the tweet passed as a parameter. ```
def
find_sentiment_ft_gpt(tweet): content = ""&…
Image Analysis Using OpenAI GPT-4o Model
Programming
Computer Science
1 Week Ago
by usmanmalik57
… in an image. ``` base64_image = encode_image64(image_path)
def
predict_sentiment(query): response = client.chat.completions.create( …. ``` base64_image1 = encode_image64(image_path1) base64_image2 = encode_image64(image_path2)
def
predict_sentiment(query): response = client.chat.completions.create( model=…
OpenAI GPT-4o vs Meta Llama 3 for Zero Shot Text Classifiation
Programming
Computer Science
2 Weeks Ago
by usmanmalik57
… The following script preprocesses the dataset and filters the tweets. ```
def
preprocess_data(dataset): # Remove rows where 'airline_sentiment' or 'text' … ``` client = Groq( api_key=os.environ.get("GROQ_API_KEY"), )
def
find_sentiment_llama3(tweet): content = """What is the sentiment…
Text to Speech Conversion Using Hugging Face Transformers
Programming
Computer Science
3 Weeks Ago
by usmanmalik57
… a function that generates speech based on the specified parameters: ```
def
generate_speech(text, language = "EN", speaker_id = "EN-US…
Claude 3 Opus Vs. Google Gemini Vs. GPT-4 for Zero-Shot Text Classification
Programming
Computer Science
2 Months Ago
by usmanmalik57
…= { "max_output_tokens": 10, "temperature": 0.0, }
def
find_sentiment_gemini(tweet): content = """What is the sentiment…get("ANTHROPIC_API_KEY") api_key = os.environ.get('ANTHROPIC_API_KEY') )
def
find_sentiment_claude(tweet): content = """What is the …
Paris Olympics Ticket Information Chatbot with Memory Using LangChain
Programming
Computer Science
2 Months Ago
by usmanmalik57
…user's input query and returns a chatbot response. ```
def
generate_response(query): response = retrieval_chain.invoke({"input":…and add them to the `chat_history` list. ``` chat_history = []
def
generate_response_with_memory(query): result = retrieval_chain.invoke({ "chat_history": chat_history,…
Paris Olympics Chatbot- Get Ticket Information Using Chat-GPT and LangChain
Programming
Computer Science
2 Months Ago
by usmanmalik57
… following script implements the method to generate the final response. ```
def
generate_response(query): response = retrieval_chain.invoke({"input": query}) print…
Using Natural Language to Query SQL Databases with Python LangChain Module
Programming
Computer Science
2 Months Ago
by usmanmalik57
… the `invoke()` method to run the query via the agent. ```
def
get_db_response(db, query): agent_executor = create_sql_agent(LLM, db=db, agent_type="…
Question Answering with YouTube Videos Using RAG in LangChain
Programming
Computer Science
1 Month Ago
by usmanmalik57
… application will be able to answer follow-up questions. ``` chat_history = []
def
generate_response_with_memory(query): result = retrieval_chain.invoke({ "chat_history": chat_history, "…
Retrieval Augmented Generation with Hugging Face Models in LangChain
Programming
Computer Science
1 Month Ago
by usmanmalik57
…;end>` token and returned only the model's reply. ```
def
generate_response(query): response = retrieval_chain.invoke({"input": query}) return…
Summarizing YouTube Video Transcriptions Using Distil Whisper and LLM
Programming
Computer Science
1 Month Ago
by usmanmalik57
… uses the Mistral-7B model to generate the model response. ```
def
generate_response(input_text, response_tokens, temperature): messages = [ {"role": "user…
Re: Extract Tabular Data from PDF Images using Hugging Face Table Transformer
Programming
Computer Science
1 Month Ago
by Harini sri
Hi, Thank you so much for the above code. Its giving better results compared to other libraries. I have few questions. In some tables, I have common column name for three columns and further I have sub columns like below.... in these cases the tables are not getting extracted properly...Do you have any suggestions for handling such cases? Also …
Re: Using Natural Language to Query SQL Databases with Python LangChain Module
Programming
Computer Science
1 Month Ago
by aishamushtaq
very helpful
def, plg explain little bit more about this
Programming
Web Development
10 Years Ago
by !@#$
def
y we need this in ruby i am beginner of ruby i donot understand what is use of
def
with out this we make code also i think according to my knowledge it is reserve word
Re: def, plg explain little bit more about this
Programming
Web Development
10 Years Ago
by sepp2k
You need the `
def
` keyword to define methods in Ruby. The reason that you need a keyword for this is that the creator of Ruby decided that was the most convenient syntax for method definitions.
def __init__ problem
Programming
Software Development
14 Years Ago
by ChargrO
…by itself but i want to implement
def
hello and
def
toggle into
def
__init__(self, master=None), at the… would like the code to stay inside the
def
__init__ because i will be adding other functions …this. [CODE] from Tkinter import * class Application(Frame):
def
__init__(self, master=None): self.master = master=None …
Re: def __init__ problem
Programming
Software Development
14 Years Ago
by ChargrO
…out here?? [CODE] from Tkinter import * class Application(Frame):
def
__init__(self, master=None): self.master = master self.menubar =…self) submenu=Menu(menubar,tearoff=0)
def
hello(self): print "hello !"
def
toggle(self): if submenu.entrycget(0,&…
def function(): help
Programming
Software Development
17 Years Ago
by mruane
… my understanding of the area... [code]
def
function(): print '''The user inputs their favourite… a different function is called.''' print prompt_funct1()
def
prompt_funct1(): prompt_f1 = raw_input("What is your… so this goes smoother! ''' except: pass
def
explain(): print '''Can I call function prompt_funct1()'s…
.def Files, dll, Linking Error
Programming
Software Development
13 Years Ago
by JimSim
… getting are similar to the one below: [ICODE]Linking... .\Reports.
def
(4) : warning LNK4017: DESCRIPTION statement not supported for the target… the problem might be with the file Reports.
def
(code below). [CODE]; Reports.
def
: Declares the module parameters for the DLL. LIBRARY…
Re: def function(): help
Programming
Software Development
17 Years Ago
by Zonr_0
… define an input statement inside of a function: [code=python]
def
question(q): #Bassiccly, you are setting the variable 'response' to… a response depending on what the user says: [code=python]
def
question(q): #Bassiccly, you are setting the variable 'response' to…
Re: def function(): help
Programming
Software Development
16 Years Ago
by caribedude
O.k. I understood everything that has gone on here so far, but what I want to know is how to extract a variable from a
def
. For example, if I wanted to use the response variable for something outside the
def
, how would I extract it?
Re: def function(): help
Programming
Software Development
16 Years Ago
by slate
… mean something like that?: [CODE=python] functs=['blue','red','yellow']
def
explain(): print("just type in the function name like… %s"%" or ".join(functs))
def
funct_blue(): print("blue called") while True: inp=raw_input…
Re: .def Files, dll, Linking Error
Programming
Software Development
13 Years Ago
by JimSim
… now solved the problem. The method name given in the .
def
file is the "decorated name" eg: [code]?ReportEventA… version of Visual Studio that I am using, amended the .
def
file accordingly, and it now works! JimSim
Re: def function(): help
Programming
Software Development
17 Years Ago
by mruane
… I tried to accomplish. So basically, if I define that
def
function1() has prompt1 == blue, then prompt1 = blue, not function1()? That…
Re: def function(): help
Programming
Software Development
17 Years Ago
by Mouche
… quite following you. Is this what you mean? [code=python]
def
function1(): prompt1 = "blue" return prompt1 color = function1() # color…
Re: def function(): help
Programming
Software Development
16 Years Ago
by Ene Uran
You use return: [code=python]
def
get_color(): color = raw_input("Enter the name of a color: ") # process it color = color.lower() return color pcolor = get_color() print pcolor [/code]
def f () / loop question
Programming
Software Development
12 Years Ago
by zentechsupport
… script. It is below I am trying to understand the
def
f() how to loop that short code over and over… on here for a while but still dont understand the
def
f(). I saw tons of examples of it used for…
Re: def function not sitting right in code...
Programming
Software Development
12 Years Ago
by bigredaltoid
…, but I am not sure how to approach it. [CODE]
def
percount(line): periods = 0 for char in line: if char… == '.': periods +=1 return periods
def
charcount(line): charnum = 0 for char in line: if char…
def Functions and Variables
Programming
Software Development
13 Years Ago
by KrazyKitsune
How do you use a variable originally from a
def
function?
Re: def Functions and Variables
Programming
Software Development
13 Years Ago
by Enders_Game
one way is to return it e.g. [CODE]
def
func(): variable = 3 return variable x = func() print(x) [/CODE] In this example, you call the function func() it does stuff and returns variable. variable is assigned to x.
1
2
3
17
Next
Last
Search
Search
Forum Categories
Hardware/Software
Recommended Topics
Programming
Recommended Topics
Digital Media
Recommended Topics
Community Center
Recommended Topics
Latest Content
Newest Topics
Latest Topics
Latest Posts
Latest Comments
Top Tags
Topics Feed
Social
Forums
Top Members
Meet People
Community Functions
DaniWeb Premium
Newsletter Archive
Markdown Syntax
Community Rules
Developer APIs
Connect API
Forum API Docs
Tools
SEO Backlink Checker
Legal
Terms of Service
Privacy Policy
FAQ
About Us
Advertise
Contact Us
© 2024 DaniWeb® LLC