Himanshusingh
commited on
Commit
•
e483bf1
1
Parent(s):
b3301a4
Update app.py
Browse files
app.py
CHANGED
@@ -94,7 +94,7 @@ def get_mean_from_proba(proba_list):
|
|
94 |
return mean
|
95 |
|
96 |
|
97 |
-
def my_inference_function(
|
98 |
txt = """
|
99 |
UNITED STATES SECURITIES AND EXCHANGE COMMISSION Washington, D.C. 20549 FORM 10-Q (Mark One) ☒ QUARTERLY REPORT PURSUANT TO SECTION 13 OR 15(d) OF THE SECURITIES EXCHANGE ACT OF 1934 For the quarterly period ended April 1, 2023 or ☐ TRANSITION REPORT PURSUANT TO SECTION 13 OR 15(d) OF THE SECURITIES EXCHANGE ACT OF 1934 For the transition period from to . Commission File Number: 001-36743 Apple Inc. (Exact name of Registrant as specified in its charter) California 94-2404110 (State or other jurisdictionof incorporation or organization) (I.R.S. Employer Identification No.) One Apple Park Way Cupertino, California 95014 (Address of principal executive offices) (Zip Code) (408) 996-1010 (Registrant’s telephone number, including area code) Securities registered pursuant to Section 12(b) of the Act: Title of each class Trading symbol(s) Name of each exchange on which registered Common Stock, $0.00001 par value per share AAPL The Nasdaq Stock Market LLC 1.375% Notes due 2024 The Nasdaq Stock Market LLC 0.000% Notes due 2025 The Nasdaq Stock Market LLC 0.875% Notes due 2025 The Nasdaq Stock Market LLC 1.625% Notes due 2026 The Nasdaq Stock Market LLC 2.000% Notes due 2027
|
100 |
The Nasdaq Stock Market LLC 1.375% Notes due 2029 The Nasdaq Stock Market LLC 3.050% Notes due 2029 The Nasdaq Stock Market LLC 0.500% Notes due 2031 The Nasdaq Stock Market LLC 3.600% Notes due 2042 The Nasdaq Stock Market LLC Indicate by check mark whether the Registrant (1) has filed all reports required to be filed by Section 13 or 15(d) of the Securities Exchange Act of 1934 during the preceding 12 months (or for such shorter period that the Registrant was required to file such reports), and (2) has been subject to such filing requirements for the past 90 days. Yes ☒ No ☐ Indicate by check mark whether the Registrant has submitted electronically every Interactive Data File required to be submitted pursuant to Rule 405 of Regulation S-T (§232.405 of this chapter) during the preceding 12 months (or for such shorter period that the Registrant was required to submit such files). Yes ☒ No ☐ Indicate by check mark whether the Registrant is a large accelerated filer, an accelerated filer, a non-accelerated filer, a smaller reporting company, or an emerging growth company. See the definitions of “large accelerated filer,” “accelerated filer,” “smaller reporting company,” and “emerging growth company” in Rule 12b-2 of the Exchange Act.
|
@@ -113,7 +113,7 @@ def my_inference_function(text):
|
|
113 |
Apple Inc. | Q2 2023 Form 10-Q | 19 PART II — OTHER INFORMATION Item 1. Legal Proceedings Epic Games Epic Games, Inc. (“Epic”) filed a lawsuit in the U.S. District Court for the Northern District of California (the “Northern California District Court”) against the Company alleging violations of federal and state antitrust laws and California’s unfair competition law based upon the Company’s operation of its App Store®.
|
114 |
The Company filed a counterclaim for breach of contract. On September 10, 2021, the Northern California District Court ruled in favor of the Company with respect to nine out of the ten counts included in Epic’s claim, and in favor of the Company with respect to the Company’s claims for breach of contract. The Northern California District Court found that certain provisions of the Company’s App Store Review Guidelines violate California’s unfair competition law and issued an injunction. On April 24, 2023, the U.S. Court of Appeals for the Ninth Circuit affirmed the Northern California District Court’s ruling. The Company is considering further review of the decision. Other Legal Proceedings The Company is subject to other legal proceedings and claims that have not been fully resolved and that have arisen in the ordinary course of business. The Company settled certain matters during the second quarter of 2023 that did not individually or in the aggregate have a material impact on the Company’s financial condition or operating results. The outcome of litigation is inherently uncertain. If one or more legal matters were resolved against the Company in a reporting period for amounts above management’s expectations, the Company’s financial condition and operating results for that reporting period could be materially adversely affected. Item 1A. Risk Factors The Company’s business, reputation, results of operations, financial condition and stock price can be affected by a number of factors, whether currently known or unknown, including those described in Part I, Item 1A of the 2022 Form 10-K under the heading “Risk Factors.” When any one or more of these risks materialize from time to time, the Company’s business, reputation, results of operations, financial condition and stock price can be materially and adversely affected. There have been no material changes to the Company’s risk factors since the 2022 Form 10-K. Item 2. Unregistered Sales of Equity Securities and Use of Proceeds Purchases of Equity Securities by the Issuer and Affiliated Purchasers Share repurchase activity during the three months ended April 1, 2023 was as follows (in millions, except number of shares, which are reflected in thousands, and per share amounts): Periods Total Numberof Shares Purchased Average PricePaid Per Share Total Number of SharesPurchased as Part of PubliclyAnnounced Plans or Programs Approximate Dollar Value of Shares That May Yet Be Purchased Under the Plans or Programs (1) January 1, 2023 to February 4, 2023: Open market and privately negotiated purchases 36,980 $ 135.21 36,980 February 5, 2023 to March 4, 2023: Open market and privately negotiated purchases 49,168 $ 150.33 49,168 March 5, 2023 to April 1, 2023: Open market and privately negotiated purchases 43,164 $ 155.32 43,164 Total 129,312 $ 22,570 (1)On April 28, 2022, the Board of Directors authorized the purchase of an additional $90 billion of the Company’s common stock under a share repurchase program. As of April 1, 2023, total utilization under the April 2022 authorization was $67.4 billion. On May 4, 2023, the Company announced the Board of Directors had authorized an additional program to repurchase up to $90 billion of the Company’s common stock. The programs do not obligate the Company to acquire a minimum amount of shares. Under the programs, shares may be repurchased in privately negotiated or open market transactions, including under plans complying with Rule 10b5-1 under the Exchange Act. Apple Inc. | Q2 2023 Form 10-Q | 20 Item 3. Defaults Upon Senior Securities None. Item 4. Mine Safety Disclosures Not applicable. Item 5. Other Information Rule 10b5-1 Trading Plans During the three months ended April 1, 2023, Katherine L. Adams, Timothy D. Cook, Luca Maestri, Deirdre O’Brien and Jeffrey Williams, each an officer for purposes of Section 16 of the Exchange Act, had equity trading plans in place in accordance with Rule 10b5-1(c)(1) under the Exchange Act. An equity trading plan is a written document that preestablishes the amounts, prices and dates (or formula for determining the amounts, prices and dates) of future purchases or sales of the Company’s stock, including sales of shares acquired under the Company’s employee and director equity plans. Item 6. Exhibits Incorporated by Reference Exhibit Number Exhibit Description Form Exhibit Filing Date/Period End Date 31.1* Rule 13a-14(a) / 15d-14(a) Certification of Chief Executive Officer. 31.2* Rule 13a-14(a) / 15d-14(a) Certification of Chief Financial Officer. 32.1** Section 1350 Certifications of Chief Executive Officer and Chief Financial Officer. 101* Inline XBRL Document Set for the condensed consolidated financial statements and accompanying notes in Part I, Item 1, “Financial Statements” of this Quarterly Report on Form 10-Q. 104* Inline XBRL for the cover page of this Quarterly Report on Form 10-Q, included in the Exhibit 101 Inline XBRL Document Set. * Filed herewith. ** Furnished herewith. Apple Inc. | Q2 2023 Form 10-Q | 21 SIGNATURE Pursuant to the requirements of the Securities Exchange Act of 1934, the Registrant has duly caused this report to be signed on its behalf by the undersigned thereunto duly authorized. Date: May 4, 2023 Apple Inc. By: /s/ Luca Maestri Luca Maestri Senior Vice President,Chief Financial Officer Apple Inc. | Q2 2023 Form 10-Q | 22
|
115 |
"""
|
116 |
-
tokens = tokenizer.encode_plus(
|
117 |
|
118 |
input_ids = tokens['input_ids']
|
119 |
total_len = len(input_ids)
|
@@ -121,8 +121,14 @@ def my_inference_function(text):
|
|
121 |
|
122 |
proba_list = chunk_text_to_window_size_and_predict_proba(input_ids, attention_mask, total_len )
|
123 |
mean = get_mean_from_proba(proba_list)
|
124 |
-
|
125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
|
127 |
gr_interface = gradio.Interface(
|
128 |
fn = my_inference_function,
|
|
|
94 |
return mean
|
95 |
|
96 |
|
97 |
+
def my_inference_function(sec_text):
|
98 |
txt = """
|
99 |
UNITED STATES SECURITIES AND EXCHANGE COMMISSION Washington, D.C. 20549 FORM 10-Q (Mark One) ☒ QUARTERLY REPORT PURSUANT TO SECTION 13 OR 15(d) OF THE SECURITIES EXCHANGE ACT OF 1934 For the quarterly period ended April 1, 2023 or ☐ TRANSITION REPORT PURSUANT TO SECTION 13 OR 15(d) OF THE SECURITIES EXCHANGE ACT OF 1934 For the transition period from to . Commission File Number: 001-36743 Apple Inc. (Exact name of Registrant as specified in its charter) California 94-2404110 (State or other jurisdictionof incorporation or organization) (I.R.S. Employer Identification No.) One Apple Park Way Cupertino, California 95014 (Address of principal executive offices) (Zip Code) (408) 996-1010 (Registrant’s telephone number, including area code) Securities registered pursuant to Section 12(b) of the Act: Title of each class Trading symbol(s) Name of each exchange on which registered Common Stock, $0.00001 par value per share AAPL The Nasdaq Stock Market LLC 1.375% Notes due 2024 The Nasdaq Stock Market LLC 0.000% Notes due 2025 The Nasdaq Stock Market LLC 0.875% Notes due 2025 The Nasdaq Stock Market LLC 1.625% Notes due 2026 The Nasdaq Stock Market LLC 2.000% Notes due 2027
|
100 |
The Nasdaq Stock Market LLC 1.375% Notes due 2029 The Nasdaq Stock Market LLC 3.050% Notes due 2029 The Nasdaq Stock Market LLC 0.500% Notes due 2031 The Nasdaq Stock Market LLC 3.600% Notes due 2042 The Nasdaq Stock Market LLC Indicate by check mark whether the Registrant (1) has filed all reports required to be filed by Section 13 or 15(d) of the Securities Exchange Act of 1934 during the preceding 12 months (or for such shorter period that the Registrant was required to file such reports), and (2) has been subject to such filing requirements for the past 90 days. Yes ☒ No ☐ Indicate by check mark whether the Registrant has submitted electronically every Interactive Data File required to be submitted pursuant to Rule 405 of Regulation S-T (§232.405 of this chapter) during the preceding 12 months (or for such shorter period that the Registrant was required to submit such files). Yes ☒ No ☐ Indicate by check mark whether the Registrant is a large accelerated filer, an accelerated filer, a non-accelerated filer, a smaller reporting company, or an emerging growth company. See the definitions of “large accelerated filer,” “accelerated filer,” “smaller reporting company,” and “emerging growth company” in Rule 12b-2 of the Exchange Act.
|
|
|
113 |
Apple Inc. | Q2 2023 Form 10-Q | 19 PART II — OTHER INFORMATION Item 1. Legal Proceedings Epic Games Epic Games, Inc. (“Epic”) filed a lawsuit in the U.S. District Court for the Northern District of California (the “Northern California District Court”) against the Company alleging violations of federal and state antitrust laws and California’s unfair competition law based upon the Company’s operation of its App Store®.
|
114 |
The Company filed a counterclaim for breach of contract. On September 10, 2021, the Northern California District Court ruled in favor of the Company with respect to nine out of the ten counts included in Epic’s claim, and in favor of the Company with respect to the Company’s claims for breach of contract. The Northern California District Court found that certain provisions of the Company’s App Store Review Guidelines violate California’s unfair competition law and issued an injunction. On April 24, 2023, the U.S. Court of Appeals for the Ninth Circuit affirmed the Northern California District Court’s ruling. The Company is considering further review of the decision. Other Legal Proceedings The Company is subject to other legal proceedings and claims that have not been fully resolved and that have arisen in the ordinary course of business. The Company settled certain matters during the second quarter of 2023 that did not individually or in the aggregate have a material impact on the Company’s financial condition or operating results. The outcome of litigation is inherently uncertain. If one or more legal matters were resolved against the Company in a reporting period for amounts above management’s expectations, the Company’s financial condition and operating results for that reporting period could be materially adversely affected. Item 1A. Risk Factors The Company’s business, reputation, results of operations, financial condition and stock price can be affected by a number of factors, whether currently known or unknown, including those described in Part I, Item 1A of the 2022 Form 10-K under the heading “Risk Factors.” When any one or more of these risks materialize from time to time, the Company’s business, reputation, results of operations, financial condition and stock price can be materially and adversely affected. There have been no material changes to the Company’s risk factors since the 2022 Form 10-K. Item 2. Unregistered Sales of Equity Securities and Use of Proceeds Purchases of Equity Securities by the Issuer and Affiliated Purchasers Share repurchase activity during the three months ended April 1, 2023 was as follows (in millions, except number of shares, which are reflected in thousands, and per share amounts): Periods Total Numberof Shares Purchased Average PricePaid Per Share Total Number of SharesPurchased as Part of PubliclyAnnounced Plans or Programs Approximate Dollar Value of Shares That May Yet Be Purchased Under the Plans or Programs (1) January 1, 2023 to February 4, 2023: Open market and privately negotiated purchases 36,980 $ 135.21 36,980 February 5, 2023 to March 4, 2023: Open market and privately negotiated purchases 49,168 $ 150.33 49,168 March 5, 2023 to April 1, 2023: Open market and privately negotiated purchases 43,164 $ 155.32 43,164 Total 129,312 $ 22,570 (1)On April 28, 2022, the Board of Directors authorized the purchase of an additional $90 billion of the Company’s common stock under a share repurchase program. As of April 1, 2023, total utilization under the April 2022 authorization was $67.4 billion. On May 4, 2023, the Company announced the Board of Directors had authorized an additional program to repurchase up to $90 billion of the Company’s common stock. The programs do not obligate the Company to acquire a minimum amount of shares. Under the programs, shares may be repurchased in privately negotiated or open market transactions, including under plans complying with Rule 10b5-1 under the Exchange Act. Apple Inc. | Q2 2023 Form 10-Q | 20 Item 3. Defaults Upon Senior Securities None. Item 4. Mine Safety Disclosures Not applicable. Item 5. Other Information Rule 10b5-1 Trading Plans During the three months ended April 1, 2023, Katherine L. Adams, Timothy D. Cook, Luca Maestri, Deirdre O’Brien and Jeffrey Williams, each an officer for purposes of Section 16 of the Exchange Act, had equity trading plans in place in accordance with Rule 10b5-1(c)(1) under the Exchange Act. An equity trading plan is a written document that preestablishes the amounts, prices and dates (or formula for determining the amounts, prices and dates) of future purchases or sales of the Company’s stock, including sales of shares acquired under the Company’s employee and director equity plans. Item 6. Exhibits Incorporated by Reference Exhibit Number Exhibit Description Form Exhibit Filing Date/Period End Date 31.1* Rule 13a-14(a) / 15d-14(a) Certification of Chief Executive Officer. 31.2* Rule 13a-14(a) / 15d-14(a) Certification of Chief Financial Officer. 32.1** Section 1350 Certifications of Chief Executive Officer and Chief Financial Officer. 101* Inline XBRL Document Set for the condensed consolidated financial statements and accompanying notes in Part I, Item 1, “Financial Statements” of this Quarterly Report on Form 10-Q. 104* Inline XBRL for the cover page of this Quarterly Report on Form 10-Q, included in the Exhibit 101 Inline XBRL Document Set. * Filed herewith. ** Furnished herewith. Apple Inc. | Q2 2023 Form 10-Q | 21 SIGNATURE Pursuant to the requirements of the Securities Exchange Act of 1934, the Registrant has duly caused this report to be signed on its behalf by the undersigned thereunto duly authorized. Date: May 4, 2023 Apple Inc. By: /s/ Luca Maestri Luca Maestri Senior Vice President,Chief Financial Officer Apple Inc. | Q2 2023 Form 10-Q | 22
|
115 |
"""
|
116 |
+
tokens = tokenizer.encode_plus(sec_text, add_special_tokens=False)
|
117 |
|
118 |
input_ids = tokens['input_ids']
|
119 |
total_len = len(input_ids)
|
|
|
121 |
|
122 |
proba_list = chunk_text_to_window_size_and_predict_proba(input_ids, attention_mask, total_len )
|
123 |
mean = get_mean_from_proba(proba_list)
|
124 |
+
sentiment = torch.argmax(mean).item()
|
125 |
+
|
126 |
+
if sentiment == 0:
|
127 |
+
return "Positive Sentiment"
|
128 |
+
elif sentiment == 1:
|
129 |
+
return "Negative Sentiment"
|
130 |
+
else:
|
131 |
+
return "Neutral"
|
132 |
|
133 |
gr_interface = gradio.Interface(
|
134 |
fn = my_inference_function,
|